This bundle provides Coinhive services. It does'nt depend of coinhive.com
To install CoinhiveBundle with Composer just type in your terminal:
php composer.phar require medzoner/coinhive-bundleNow, 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(),
// ...
);Add the following to your config file:
# app/config/config.yml
coinhive:
config:
site_key: '%coinhive.site_key%'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()
]
])
;
}
//...Add the following to your twig files:
{{ coinhive_miner() }}

