symplify / Package Builder
Licence: mit
[READ-ONLY] Speed up your package DI containers integration and console apps to Symfony and Nette
Stars: ✭ 152
Projects that are alternatives of or similar to Package Builder
Quicklib
Quick development library (AutoMapper, LinQ, IOC Dependency Injection, MemoryCache, Scheduled tasks, Config, Serializers, etc) with crossplatform support for Delphi/Firemonkey (Windows,Linux,OSX/IOS/Android) and freepascal (Windows/Linux).
Stars: ✭ 274 (+80.26%)
Mutual labels: console, dependency-injection
Console Parallelization
Enables the parallelization of Symfony Console commands.
Stars: ✭ 166 (+9.21%)
Mutual labels: console, symfony
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+1755.92%)
Mutual labels: console, symfony
Dependency Injection
The DependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.
Stars: ✭ 3,635 (+2291.45%)
Mutual labels: symfony, dependency-injection
Drupal Console
The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
Stars: ✭ 913 (+500.66%)
Mutual labels: console, symfony
Fluent Symfony
Fluent configuration for Symfony
Stars: ✭ 80 (-47.37%)
Mutual labels: symfony, dependency-injection
Console
The Console component eases the creation of beautiful and testable command line interfaces.
Stars: ✭ 8,988 (+5813.16%)
Mutual labels: console, symfony
Consolebundle
Commandline interface in browser for Symfony2
Stars: ✭ 138 (-9.21%)
Mutual labels: console, symfony
Hiboot
hiboot is a high performance web and cli application framework with dependency injection support
Stars: ✭ 150 (-1.32%)
Mutual labels: dependency-injection
Core
The server component of API Platform: hypermedia and GraphQL APIs in minutes
Stars: ✭ 2,004 (+1218.42%)
Mutual labels: symfony
Clog
Package clog is a channel-based logging package for Go
Stars: ✭ 151 (-0.66%)
Mutual labels: console
Sactive Web
🚀 A dependency injection web framework for Node.js.
Stars: ✭ 143 (-5.92%)
Mutual labels: dependency-injection
Dunglasangularcsrfbundle
Automatic CSRF protection for JavaScript apps using a Symfony API
Stars: ✭ 152 (+0%)
Mutual labels: symfony
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (+0%)
Mutual labels: console
Bicing Api
Get statistics and locations of bicycle stations through REST API
Stars: ✭ 149 (-1.97%)
Mutual labels: symfony
Package Builder
This tools helps you with Collectors in DependecyInjection, Console shortcuts, ParameterProvider as service and many more.
Install
composer require symplify/package-builder
Use
Get All Parameters via Service
- Register
ParameterProvider
service in your config:
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\PackageBuilder\Parameter\ParameterProvider;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()
->autowire();
$services->set(ParameterProvider::class);
$parameter = $containerConfigurator->parameters();
// will be used later
$parameter->set('source', 'src');
};
- Require
ParameterProvider
in__construct()
where needed:
namespace App\Configuration;
use Symplify\PackageBuilder\Parameter\ParameterProvider;
final class ProjectConfiguration
{
/**
* @var ParameterProvider
*/
private $parameterProvider;
public function __construct(ParameterProvider $parameterProvider)
{
$this->parameterProvider = $parameterProvider;
}
public function getSource(): string
{
// returns "src"
return $this->parameterProvider->provideParameter('source');
// use specific typed method to avoid `mixed`
return $this->parameterProvider->provideStringParameter('source');
}
}
Get Vendor Directory from Anywhere
use Symplify\PackageBuilder\Composer\VendorDirProvider;
$vendorDirProvider = new VendorDirProvider();
// returns path to vendor directory
$vendorDirProvider->provide();
Smart Compiler Passes for Lazy Programmers ↓
Always Autowire this Type
Do you want to allow users to register services without worrying about autowiring? After all, they might forget it and that would break their code. Set types to always autowire:
namespace App;
use PhpCsFixer\Fixer\FixerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireInterfacesCompilerPass;
final class AppKernel extends Kernel
{
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new AutowireInterfacesCompilerPass([FixerInterface::class]));
}
}
This will make sure, that PhpCsFixer\Fixer\FixerInterface
instances are always autowired.
That's all :)
Report Issues
In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker
Contribute
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].