Download the PHP package phpdevcommunity/michel-package-starter without Composer
On this page you can find all versions of the php package phpdevcommunity/michel-package-starter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpdevcommunity/michel-package-starter
More information about phpdevcommunity/michel-package-starter
Files in phpdevcommunity/michel-package-starter
Package michel-package-starter
Short Description The core interface required for creating and integrating packages into the Michel framework.
License MIT
Informations about the package michel-package-starter
Creating an PhpDevCommunity Michel Package
In Michel Framework, you can create packages, which are equivalent to bundles in Symfony. This allows you to organize and share reusable components across different projects. To create an PhpDevCommunity Michel package, you need to implement the PackageInterface
and define your package's services, parameters, event listeners, routes, and commands.
You can install this library via Composer. Ensure your project meets the minimum PHP version requirement of 7.4.
Package Interface
Start by creating a package class that implements the PackageInterface
. This interface defines the methods you need to implement for your package.
Example Package
Here's an example of an PhpDevCommunity Michel package class (MyCustomPackage
) that implements the PackageInterface
. This package provides some default definitions, parameters, and commands. Note that this is just an example; you should create your own package based on your project's requirements.
Defining Your Package
Implementing getDefinitions
In the getDefinitions
method, define the services your package provides. You can use the Dependency Injection Container to create and configure these services.
Implementing getParameters
The getParameters
method allows you to define parameters specific to your package. These parameters can be customized in the project's configuration.
Implementing getListeners
If your package includes event listeners, define them in the getListeners
method.
Implementing getRoutes
If your package provides routes, specify them in the getRoutes
method.
Implementing getCommands
If your package includes console commands, list them in the getCommands
method.
Activating Your Package
To activate your package in an PhpDevCommunity Michel project, you need to modify the packages.php
file located in the /config
directory. Add your package class to the list of packages along with the environment(s) where it should be active.
In this example, the MyCustomPackage
is activated for both the 'dev' and 'prod' environments. You can adjust the list of environments as needed.
By following these steps, you can create and activate your PhpDevCommunity Michel packages to extend the functionality of your projects.