Framework
The mini4work/framework Composer package gives you an application skeleton with a working console entry point. It depends on mini4work/core ^2.0, which creates services, manages their lifetimes and runs your kernel.
Create an application
Install Composer and PHP 8.3 or a later 8.x release. The last argument to create-project names the directory Composer creates.
composer create-project mini4work/framework myFirstApp
cd myFirstApp
php m4w helloThe starter prints the Mini4Work logo, a message from an injected service and the argument hello. This exercises the container and the console kernel without starting an HTTP listener.
Follow the first run
use App\Kernels\BaseKernel;
use M4W\Core\Framework;
require __DIR__.'/vendor/autoload.php';
$app = new Framework();
$kernel = $app->make(BaseKernel::class);
$app->run($kernel);new Framework()creates an isolated container. It binds itself and a default exception handler.make(BaseKernel::class)injects that container into the kernel constructor. Provider registration begins when the entry point callsrun().BaseServiceProviderregistersBaseServiceas a singleton. When the demo requests it, the container constructs itsDependencyServiceandConsoleServicedependencies.
Extend the application
Put application services in app/Services/. To choose a specific implementation or share an instance, register it in app/ServiceProviders/BaseServiceProvider.php. To change what the application does on startup, edit app/Kernels/BaseKernel.php.
- Container parameters — pass constructor values, bind interfaces and choose a lifetime.
- Kernels and providers — choose providers, configure error reporting and release resources.
- CLI and modules — discover commands, install packages and generate application files.