New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

apie/service-provider-generator

Creates a service provider for Laravel from a Symfony services.yaml
88,304

Larablocks Analysis

apie/service-provider-generator works with Laravel 7 to 13 (latest release 0.15.0, Nov 8, 2026).

Recommendation checks

Solid choice

Solid choice: maintained and up to date, meets 2 of 4 checks; below the bar for Recommended on use.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Nov 8, 2026)
  • 2,100 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Nov 8, 2026.
  • 5 releases in the last 12 months.
  • First released: Sep 9, 2023.
  • Monthly downloads: 2,100.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.

Install
composer require apie/service-provider-generator
Latest Version:0.15.0
Laravel:7 – 13
License:MIT
Last Updated:Nov 8, 2026
Links: GitHub  ·  Packagist
Maintainer: pjordaan

ServiceProvider generator

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require Code coverage

PHP Composer

This package is part of the Apie library.

Documentation

One issue with writing framework agnostic code is that most frameworks have different ways to register classes in their service container.

  • The Symfony framework works with configuration files, attributes and autowiring.
  • Laravel works with autowiring everything or writing PHP code in a ServiceProvider how to instantiate a specific service.

If we want our code to be framework agnostic we need a way to make sure we do not need maintain 2 'service container registries'.

That's where this library comes in. We use the Symfony yaml configuration files as basis and let it generate a ServiceProvider class that Laravel can use. That way we can make our library work effortlessly

Code usage

The class only creates a string with the source code, you have to manually store it in a file (recommended) or use the 'evil' eval() method.

<?php
use Apie\ServiceProviderGenerator\ServiceProviderGenerator;
$generator = new ServiceProviderGenerator();
file_put_contents('/src/ExampleServiceProvider.php', $generator->generateClass(App\ExampleServiceProvider::class, 'resources/config/example-service.yaml'));

Supported Symfony dependency injection features:

Here is a list of everything supported. Not much is supported, because a transition is not trivial or Laravel does not support it without hacks. For example private services do not exist in Laravel. Also some of these features are considered bad practices if you use them outside your application in your package, so are highly likely not to be implemented.

Feature Support
_defaults No
autowire No
autoconfigure No
reading PHP 8 attributes No
deprecated Yes
resource + exclude No
arguments by index Yes
arguments by name >= PHP8 code
service references Yes, not within array constants
constant strings starting with '@' Yes
reading parameters Mapped as Laravel config()
reading environment variables Mapped as laravel env()
environment variable parsers No
!closure No
public/private services NA
tags Only simple tags
from_callable No
aliasing Yes
anonymous services No
method calls Yes
!returns_clone No
expression language No
other imports No
Factory Service Yes
Static Factory Yes
Invokable Factory Yes
Property injection No
Lazy services No
Optional arguments Mapped as app()->bound()
parent definitions No
!service_closure No
decorators No
optional decorator No
service subscriber No
!service_locator No
@service_container No
!tagged_locator Basic support
!tagged_service Basic support
synthetic Yes
shared Yes

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released Laravel License
0.15.0 7.*|8.*|9.*|10.*|11.*|12.*|13.* MIT
0.14.0 7.*|8.*|9.*|10.*|11.*|12.* MIT
0.13.2 7.*|8.*|9.*|10.*|11.*|12.* MIT
0.13.1 7.*|8.*|9.*|10.*|11.*|12.* MIT
0.13.0 7.*|8.*|9.*|10.*|11.*|12.* MIT