medzoner / coinhive-bundle
This bundle provides Coinhive services. It does'nt depend of coinhive.com
Installs: 793
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.3
- symfony/form: ^2.8 || ^3.0
- symfony/framework-bundle: ^2.8 || ^3.0
- symfony/validator: ^2.8 || ^3.0
- twig/extensions: ^1.5
Requires (Dev)
- phpunit/phpunit: ~5.3
This package is auto-updated.
Last update: 2024-05-23 22:37:20 UTC
README
This bundle provides Coinhive services. It does'nt depend of coinhive.com
Installation
Step 1: Use composer and enable Bundle
To install CoinhiveBundle with Composer just type in your terminal:
php composer.phar require medzoner/coinhive-bundle
Now, Composer will automatically download all required files, and install them
for you. All that is left to do is to update your AppKernel.php
file, and
register the new bundle:
<?php // in AppKernel::registerBundles() $bundles = array( // ... new Medzoner\Bundle\CoinhiveBundle(), // ... );
Step2: Configure the bundle's
Add the following to your config file:
# app/config/config.yml coinhive: config: site_key: '%coinhive.site_key%'
Step3a: Use captcha in form
Add the following to your formType file:
<?php use CoinhiveBundle\Validator\IsTrue; //.... /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('coinhive-captcha-token', CoinHiveCaptchaType::class, [ 'mapped' => false, 'constraints' => [ new IsTrue() ] ]) ; } //...
Step3b: Use miner on your site
Add the following to your twig files:
{{ coinhive_miner() }}