Download the PHP package pierresilva/laravel-modules without Composer

On this page you can find all versions of the php package pierresilva/laravel-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-modules

Laravel Modules

Modules is a simple package to allow the means to separate your Laravel 5.3 application out into modules. Each module is completely self-contained allowing the ability to simply drop a module in for use.

Quick Installation

Begin by installing the package through Composer.

Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php file:

Service Provider

Facade

Module Structure

The package is built with Laravel 5 in mind. Modules follow the same app structure adopted with the latest version of Laravel, ensuring that modules feel like a natural part of your application.

Manifest File

Along with the structure, every module has a module.json manifest file. This manifest file is used to outline information such as the description, version, author(s), and anything else you'd like to store pertaining to the module at hand.

Configuration

Publishing The Config File

To publish the bundled config file, simply run Laravel's vendor:publish Artisan command:

Path to Modules

You may define the path where you'd like to store your modules.

Module's Base Namespace

Define the base namespace for your modules.

Note: Be sure to update this path if you move your modules to another directory.

To move modules folder

Restructure your modules

You can alter the internal structure of your modules without affecting the scaffolding and migration commands. For example, if you want to put your php code in a src directory and leave out the resources files you could do something like this:

Notice that the keys here are just based on the default module structure

Resources

Views

Module views are referenced using a double-colon module::view syntax. So you may load the admin view from the blog module like so:

Overriding Module Views

Modules registers two locations for your views for each module: one in the application's resources/views/vendor directory and one in your module's resources directory. So, using our blog example: when requesting a module view, Laravel will first check if a custom version of the view has been provided in resources/views/vendor/blog. Then, if the view has not been customized, Laravel will search the module's view directory. This makes it easy for end-users to customize/override your module's views.

Translations

Modules registers the Resources/Lang location for your translation files within each of your modules. Module translations are referenced using a double-colon module::file.line syntax. So, you may load the blog module's welcome line from the messages file like so:

Public Assets

Just like packages for Laravel, your modules may have assets such as JavaScript, CSS, and images. To publish these assets to the application's public directory, use the service provider's publishes method. You may do this within your module's primary service provider, or create a service provider specifically for assets.

In this example, we'll be storing our assets in an Assets directory at the root of our module. We will also add a modules asset group tag, which may be used to publish groups of related assets:

Now, when you execute the vendor:publish command, your module's assets will be copied to the specified location. Since you typically will need to overwrite the assets every time the module is updated, you may use the --force flag:

If you would like to make sure your public assets are always up-to-date, you can add this command to the post-update-cmd list in your composer.json file.

Middleware

Modules comes bundled with middleware that you may use within your application. Below you will find a description of each one with examples of their uses.

The Identify Module middleware provides the means to pull and store module manifest information within the session on each page load. This provides the means to identify routes from specific modules.

Register

Simply register as a route middleware with a short-hand key in your app/Http/Kernel.php file.

Usage

Now, you may simply use the middleware key in the route options array. The IdentifyModule middleware expects the slug of the module to be passed along in order to locate and load the relevant manifest information.

Result

If you dd() your session, you'll see that you have a new module array key with your module's manifest information available.

Composer Support

Installation

To get started, simply require the plugin through Composer for your application:

Usage

Now, for every module that requires their own composer dependencies to be installed with your application, simply create a composer.json file at the root of your module:

Then simply run composer update per normal! Wikimedia's composer merge plugin will automatically parse all of your modules composer.json files and merge them with your main composer.json file dynamically.

Facade Reference

Module::all()

Get all modules.

Module::all()

Get all module slugs.

Module::where($key, $value)

Get modules based on where clause.

Module::sortBy($key)

Get modules based on where clause.

Module::sortByDesc($key)

Sort modules by the given key in descending order.

Module::exists($slug)

Check if given module exists.

Module::count()

Returns a count of all modules.

Module::getProperties($slug)

Returns the modules defined properties.

Module::get($property, $default)

Returns the given module manifest property.

Module::set($property, $value)

Set the given module manifest property value.

Module::enable($slug)

Enable the specified module.

Module::disable($slug)

Disable the specified module.

Module::enabled()

Gets all enabled modules.

Module::disabled()

Gets all disabled modules.

Module::isEnabled($slug)

Checks if specified module is enabled.

Module::isDisabled($slug)

Checks if specified module is disabled.

Artisan Commands

Modules package comes with a handful of Artisan commands to make generating and managing modules easy.

module:make [slug]

Generate a new module. This will generate all the necessary folders and files needed to bootstrap your new module. The new module will be automatically enabled and work out of the box.

module:make:controller [slug] [ControllerName]

Generate a new module controller class.

module:make:migration [slug] [migration_name]

Generate a new module migration file.

module:make:seeder [slug] [SeederName]

Generate a new module seeder file.

For migrate entry blog seders create a [ModuleName]DatabaseSeeder class into Database\Seeders folder module, and include your generate Sedder classes in run() method.

module:make:request [slug] [RequestName]

Create a new module form request class.

module:make:test [slug] [TestName] [--unit]

Create a new module feature test class.

Create a new module unit test class.

After that the php artisan test command can find the module tests classes.

module:enable [slug]

Enable a module.

module:list

List all application modules.

module:migrate [slug]

Migrate the migrations from the specified module or from all modules.

Migrate all modules.

Migrate specific module.

module:migrate:refresh [slug]

Reset and re-run all migrations for a specific or all modules.

Parameters

module:migrate:reset [slug]

Rollback all database migrations for a specific or all modules.

Parameters

Reset all modules migrations.

Reset specific module migrations.

module:migrate:rollback [slug]

Rollback the last database migrations for a specific or all modules.

Parameters

Rollback all modules migrations.

Rollback specific module migrations.

module:seed [slug]

Seed the database with records for a specific or all modules.

Parameters

Seed all modules.

Seed specific module.

Start building out some awesome modules!

Author

Pierre Silva


All versions of laravel-modules with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0|^8.1
laravel/legacy-factories Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pierresilva/laravel-modules contains the following files

Loading the files please wait ....