1. Go to this page and download the library: Download comphp/service-management library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comphp / service-management example snippets
$services = new CommonPHP\ServiceManager\ServiceManager();
class MyService implements BootstrapperContract
{
public function bootstrap(ServiceManager $serviceManager): void
{
// Bootstrap logic goes here
}
}
$services->register(MyService::class);
$instance = $services->get(MyService::class); // MyService's bootstrap method will be called
class MyServiceProvider implements ServiceProviderContract, BootstrapperContract
{
public function bootstrap(ServiceManager $serviceManager): void
{
// Bootstrap logic goes here
}
// Implement other methods from ServiceProviderContract...
}
$services->providers->registerProvider(MyServiceProvider::class); // MyServiceProvider's bootstrap method will be called
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.