PHP code example of webchemistry / service-attribute

1. Go to this page and download the library: Download webchemistry/service-attribute 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/ */

    

webchemistry / service-attribute example snippets


 declare(strict_types = 1);

use Nette\Utils\Finder;
use WebChemistry\ServiceAttribute\DecoratorFinder;
use WebChemistry\ServiceAttribute\Generator\DecoratorNeonGenerator;
use WebChemistry\ServiceAttribute\Generator\NeonFile;
use WebChemistry\ServiceAttribute\Generator\ServiceNeonGenerator;
use WebChemistry\ServiceAttribute\ServiceFinder;
use WebChemistry\ServiceAttribute\Validator\DecoratorValidator;

%d decorators: file://%s\n", count($decorators), $path);

// services
echo "\e[36mServices\e[39m\n";
$services = ServiceFinder::findServices($directory);

$neon = new NeonFile($path = __DIR__ . '/app/generated/services.neon', (new ServiceNeonGenerator($services))->generate());
$neon->diff();
$neon->save();

echo sprintf("File generated from %d services: file://%s\n", count($services), $path);
bash
php services.php