PHP code example of tjventurini / service-provider

1. Go to this page and download the library: Download tjventurini/service-provider 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/ */

    

tjventurini / service-provider example snippets


use Tjventurini\ServiceProvider\SimpleServiceProvider;

class YourPackageServiceProvider extends SimpleServiceProvider

use Tjventurini\ServiceProvider\SimpleServiceProvider;

class YourPackageServiceProvider extends SimpleServiceProvider
{
    /**
     * Setup the configuration for the given package.
     *
     * @param  Package $Package
     * @return void
     */
    public function configurePackage(Package $Package): void
    {
        $Package
            ->setPackageSlug('your-package-slug')
            ->hasConfig()
            ->hasMigrations()
            ->hasTranslations()
            ->hasCommands([
                SomeCommand::class,
                AnotherCommand::class
            ])
            ->hasGraphQLSchema()
            ->hasGraphQLNamespaces([
                'models' => 'Foo\\Bar'
            ])
            ->registerService(SomeService::class)
            ->registerService(ServiceWithConfig::class, ['api_key' => 'some-key'])
            ->hasWebRoutes()
            ->hasApiRoutes()
            ->registerRouteFile('routes/admin.php');
    }
}