Download the PHP package khaleelibrahim/laravel-modular without Composer

On this page you can find all versions of the php package khaleelibrahim/laravel-modular. 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-modular

Laravel Modular

A modular architecture system for Laravel applications. Run php artisan make:module {Name} and get a fully-wired, self-contained feature module — controller, service, repository (with tag-based, tenant-scoped caching), Form Requests, API Resource, and its own Service Provider — instead of hand-rolling everything under app/Http and app/Services.

Installation

The package's Service Provider is auto-discovered. Publish the config and/or stub templates:

Publishing modular-stubs copies the generator templates to stubs/laravel-modular/ in your application, where you can edit them freely — the package always prefers a published stub over its own internal copy.

Configuration (config/modular.php)

The module folder convention

Every module lives at {path}/{ModuleName}/ with this structure:

Folder Purpose
Controllers/ Thin HTTP controllers — input, delegate to the service, respond. No business logic, no direct DB/repository access.
DTO/ Data Transfer Objects for passing structured data between layers.
Enums/ Module-scoped enums (only when applicable).
Models/ Eloquent models for this module.
Observers/ Model observers for lifecycle hooks (only when applicable).
Providers/ The module's Service Provider — binds interfaces to implementations, loads the module's routes.
Repositories/ DB operations + cache management. Extends the package's BaseRepository. No business logic.
Requests/ Laravel Form Requests for input validation.
Resources/ API response transformers (Laravel API Resources).
Routes/ Module-scoped route definitions, loaded by the module's own Service Provider.
Services/ All business logic. Injected with repository interfaces, never concrete classes. Never queries the DB directly.

Rules the generators encode:

Artisan commands

Command What it does
make:module {Name} Scaffolds the full folder tree, the module's Service Provider, and an empty Routes/api.php.
make:module-model {Module} {Entity} Generates Models/{Entity}.php.
make:module-repository {Module} {Entity} Generates Repositories/Contracts/{Entity}RepositoryInterface.php and Repositories/{Entity}Repository.php, then inserts a $this->app->bind(...) line into the module's Service Provider (idempotent).
make:module-service {Module} {Entity} Generates Services/Contracts/{Entity}ServiceInterface.php and Services/{Entity}Service.php (constructor-injecting the matching repository interface), then inserts its own bind line into the Service Provider (idempotent).
make:module-controller {Module} {Entity} Generates Controllers/{Entity}Controller.php, constructor-injecting {Entity}ServiceInterface.
make:module-request {Module} {Entity} Generates Requests/Create{Entity}Request.php and Requests/Update{Entity}Request.php.
make:module-resource {Module} {Entity} Generates Resources/{Entity}Resource.php.
make:module-enum {Module} {Name} Generates Enums/{Name}.php.
make:module-observer {Module} {Entity} Generates Observers/{Entity}Observer.php.
module:cache Discovers module Service Providers and caches the list to bootstrap/cache/modules.php.
module:clear Clears that cache.

Every generator command accepts --force to overwrite existing files, normalizes names with Str::studly(), and pulls templates from your published stubs/laravel-modular/ directory when present, falling back to the package's built-in stubs otherwise.

Caching

BaseRepository gives every module repository tag-based, tenant-scoped caching for free:

Provider auto-discovery

On boot, the package scans config('modular.path') for */Providers/*ServiceProvider.php files, resolves their fully-qualified class name from config('modular.namespace'), and registers each one with the container — so you never list module providers in bootstrap/providers.php by hand.

To avoid a filesystem scan on every request in production, cache the discovered list (mirroring Laravel's own package:discover cache):

Set MODULAR_AUTO_REGISTER=false (or 'auto_register_providers' => false in the config) to disable auto-discovery entirely and register module providers yourself.

Quick start

This produces app/Modules/Blog/ with a PostController, PostService/PostServiceInterface, PostRepository/PostRepositoryInterface (both bound automatically in BlogServiceProvider), Post model, CreatePostRequest/UpdatePostRequest, and PostResource — all wired together.

Add the standard CRUD routes to the generated (empty) app/Modules/Blog/Routes/api.php:

Because BlogServiceProvider is auto-discovered and its boot() already calls loadRoutesFrom(__DIR__ . '/../Routes/api.php'), these routes are immediately reachable at /api/v1/posts — no manual registration required.

Testing

Tests use Orchestra Testbench and cover the generator commands, the bind-insertion behavior, BaseRepository caching against both a taggable and non-taggable store, and provider auto-discovery.

License

MIT.


All versions of laravel-modular with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
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 khaleelibrahim/laravel-modular contains the following files

Loading the files please wait ...