brainexe / annotations
This package is abandoned and no longer maintained.
The author suggests using the brainexe/core package instead.
Simple @annotation library based on doctrine annotations for symfony dependency injection container
1.0.11
2017-01-09 20:32 UTC
Requires
- doctrine/annotations: 1.3.*
- symfony/config: ~3.2
- symfony/dependency-injection: ~3.2
Requires (Dev)
- phpunit/phpunit: ~5.3
README
composer require brainexe/annotations 1.0.*
Annotations
The files in this archive are released under the MIT license. You can find a copy of this license in the LICENSE file.
Example
// Logger.php /** * @Service(public=false) */ class Logger { /** * @Inject("%log.file%") */ public function __construct($logFile); public function log(); } // Command.php class Command { /** * @var Logger */ private $logger; /** * @Inject("@Logger") */ __construct(Logger $logger) { $this->logger = $logger; } public function run() { $this->logger->log("Start"); // do something... $this->logger->log("Done"); } } // run.php use BrainExe\Annotations\Loader; $container = new ContainerBuilder(); $container->setParameter("log.file", "logs/file.log"); $loader = new Loader($container) $loader->load('src/'); /** @var Command */ $command = $dic->get('Command'); $command->run();
Tests
phpunit