PHP code example of bentools / user-aware-command-bundle

1. Go to this page and download the library: Download bentools/user-aware-command-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bentools / user-aware-command-bundle example snippets


# app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles() 
    {
        // ...
        $bundles[] = new BenTools\UserAwareCommandBundle\UserAwareCommandBundle();
    }
}

namespace AppBundle\Command;

use BenTools\UserAwareCommandBundle\Model\UserAwareInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DoMyCommand extends Command implements UserAwareInterface 
{
    protected function execute(InputInterface $input, OutputInterface $output) {
	    // ...
	}
}