2017 © Pedro Peláez
 

library laravel-package-manager

Package Manager for laravel packages

image

ipunkt/laravel-package-manager

Package Manager for laravel packages

  • Wednesday, November 1, 2017
  • by rokde
  • Repository
  • 2 Watchers
  • 0 Stars
  • 231 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 63 % Grown

The README.md

Package Manager

Total Downloads Latest Stable Version Latest Unstable Version License, (*1)

Introduction

Package Manager helps reducing the package creation time. Therefore it supports some basic providers for laravel packages., (*2)

This package plays nicely with the laravel plugin seeder package., (*3)

Just create a new plugin with composer create-package ipunkt/laravel-package YOUR-PACKAGE-NAME and you are able to start with all the package manager supports out of the box., (*4)

Installation

Add this package as dependency by using composer require ipunkt/laravel-package-manager:^1.0, (*5)

Usage

We suggest using a Package Service Provider extending the Illuminate\Support\AggregateServiceProvider and register all your package related providers as attribute like so:, (*6)

<?php

namespace MyPackage\Providers;

use Illuminate\Support\AggregateServiceProvider;

class MyPackageServiceProvider extends AggregateServiceProvider
{
    /**
     * The provider class names.
     *
     * @var array
     */
    protected $providers = [
        ConfigProvider::class,
        BindingsProvider::class,
        ArtisanProvider::class,
        MigrationsProvider::class,
        TranslationsProvider::class,
        BladeProvider::class,
        RoutesProvider::class,
        ViewProvider::class,
        EventsProvider::class,
    ];
}

And in your composer.json simply auto-register only your aggregate service provider like so:, (*7)

{
    "extra": {
        "laravel": {
            "providers": [
                "MyPackage\\Providers\\MyPackageServiceProvider"
            ]
        }
    }
}

Base Service Providers included

We include various service providers for the most common package needs. So you can simply use / extend them and at it to your package service provider., (*8)

Package Configuration

If you want to register package configuration you have to extend the ConfigurationServiceProvider., (*9)

First of all, please add a protected $packagePath to your extended service provider class and give it a value for the package root folder like so: protected $packagePath = __DIR__ . '/../../';. This is necessary to mark your files relative to the package root., (*10)

You have to add your configuration files in attribute $configurationFiles. File by file as array item. If you want to give an alias for config you have to set is array key. For example:, (*11)

Within your package you have a config/config.php and you want to have it published and merged as my-package you have to set it like so, (*12)

'my-package' => 'config/config.php', (*13)

Then you can get config values by using config('my-package.)., (*14)

Routes

For providing routes you have to extend the RouteServiceProvider., (*15)

First of all, please add a protected $packagePath to your extended service provider class and give it a value for the package root folder like so: protected $packagePath = __DIR__ . '/../../';. This is necessary to mark your files relative to the package root., (*16)

Just set $routesNamespace, $routesMiddleware and $routesFile to your needs and you are ready to go. For registering various routes you should have one provider for each type of routes file (api, web, ...)., (*17)

Views / Templates

We provide the ViewServiceProvider for extension., (*18)

First of all, please add a protected $packagePath to your extended service provider class and give it a value for the package root folder like so: protected $packagePath = __DIR__ . '/../../';. This is necessary to mark your files relative to the package root., (*19)

You have to set the $namespace to your package based identifier. The $templatesFolder is set to the resources/views by default, you can override it., (*20)

Database Migrations

We provide the MigrationServiceProvider to provide database migration files from package., (*21)

First of all, please add a protected $packagePath to your extended service provider class and give it a value for the package root folder like so: protected $packagePath = __DIR__ . '/../../';. This is necessary to mark your files relative to the package root., (*22)

You have to set the $migrationsFolder to your package migrations., (*23)

Translations

We provide the TranslationServiceProvider for extension., (*24)

First of all, please add a protected $packagePath to your extended service provider class and give it a value for the package root folder like so: protected $packagePath = __DIR__ . '/../../';. This is necessary to mark your files relative to the package root., (*25)

You have to set the $namespace to your package based identifier. The $translationsFolder is set to the resources/lang by default, you can override it., (*26)

For the new implemented way for json files we also support the $useJson flag. When true the given files have to be json format., (*27)

Artisan Commands

For registering artisan console command we provide the ArtisanServiceProvider., (*28)

You have to fill the $commands array with your commands. If you provide a key this key will be the key for registration within the IoC container of laravel. The value should be the command class name like SuperCommand::class or a string e.g. SuperCommand which gets resolved to lookup a method registerSuperCommand within the service provider (protected at least to get called). So you can register more complex commands by using a separate method., (*29)

By default artisan commands will registered only on console runs. If you want to change that behaviour you can overwrite the value of $registerOnlyForConsole to make that happen., (*30)

Aliases

We provide an AliasServiceProvider to register all aliases by hand. But you should provide aliases by the new package discovery:, (*31)

{
    "extra": {
        "laravel": {
            "providers": [
                "YourProvider"
            ],
            "aliases": {
                "Alias": "Path\\To\\Facade"
            }
        }
    },
}

Common Resolutions

Namespace for views, config, translations, ...

Your aggregated package provider should provide a constant namespace identifier for your package. So you can re-use the same value in all your single package providers consistently., (*32)

License

Package Manager is open-sourced software licensed under the MIT license, (*33)

The Versions

01/11 2017

dev-master

9999999-dev

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

01/11 2017

1.0.5

1.0.5.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

01/11 2017

1.0.4

1.0.4.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

01/11 2017

1.0.3

1.0.3.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

01/11 2017

1.0.2

1.0.2.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

29/10 2017

1.0.1

1.0.1.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

29/10 2017

1.0.0

1.0.0.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

06/12 2016

0.2.0

0.2.0.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

06/12 2016

0.1.1

0.1.1.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package

06/12 2016

0.1.0

0.1.0.0

Package Manager for laravel packages

  Sources   Download

MIT

The Requires

 

by Robert Kummer

laravel package