Download the PHP package protibimbok/laramod without Composer

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

Laramod

Explicit modules for Laravel.

A module is a class. What it provides is declared by the contracts that class implements, and modules are listed by hand in one file. There is no auto-discovery, no manifest, no cache to rebuild and no per-module composer.json.

Requirements

Installation

laramod:init is safe to run again at any time. It:

composer.json and phpunit.xml are edited as text, so the rest of the file stays as you wrote it. When the expected place is not found, the command prints the line to add by hand instead.

Creating a module

The command also lists the module in bootstrap/modules.php:

Option Result
(none) Web and API routes, controllers, translations, config, migrations and a feature test
--api API routes, a controller, config, migrations and a feature test
--plain Only the module class, providing nothing yet
--order=10 Also implements Ordered with the given position

Directories that hold classes are StudlyCase (Http, Models, Database, Tests), everything else is lowercase (config, lang, resources, routes, ai-workflow).

The stubs can be customised after php artisan vendor:publish --tag=laramod-stubs.

Registering modules

bootstrap/modules.php returns the module classes. The order of the list is the order the modules are wired in. A module from a Composer package is added to the same list.

Modules can also be registered from the register() method of any service provider:

What a module can provide

A module gains a capability by implementing its contract from Laramod\Contracts. Nothing is looked up on disk: a module without ProvidesViews has no views, whatever its directories contain.

A path a module returns is relative to its path(): 'resources/views'. An absolute path is taken as it is.

Contract Method Wired as
ProvidesRoutes routes(Router $router): void Routes inside the web group of config/laramod.php
ProvidesApiRoutes apiRoutes(Router $router): void Routes inside the api group (prefix api)
ProvidesGlobalMiddlewares globalMiddlewares(): array Appended to the global middleware stack
ProvidesMigrations migrations(): array Directories that migrate also runs
ProvidesSeeders seeders(): array Seeders for the data the module needs, see Seeders
ProvidesCommands commands(): array Artisan commands
ProvidesViews views(): string View and Blade component namespace, blog::…
ProvidesTranslations translations(): string Translation namespace, blog::…, and JSON translations
ProvidesConfig config(): array Config files, keyed by the key they are merged into
ProvidesViteEntries viteEntries(): array Source files Vite builds, relative to the module, see Vite
Ordered order(): int Lower is wired first, a negative order last, ties keep the registration order

Views, translations and components use the module name as their namespace:

Anonymous components live in resources/views/components, class components in the module's View\Components namespace.

Routes

Module routes must point to controller actions, never closures, so route:cache keeps working. Once the routes are cached, the route methods of the modules are not called at all.

Config

Generated modules merge their config under modules.<name>:

The prefix keeps a module called Auth, Cache or Mail away from the framework's own config. A module is free to return another key.

Seeders

ProvidesSeeders is for the data a module cannot work without. Demo and test data stay ordinary seeders that the application registers and calls itself.

Module seeders only run where you ask for them, for example in DatabaseSeeder:

Seeder::runSeeders() runs the seeders of every module in the order the modules are wired, Seeder::runSeeders('blog') those of one module. Both are silent. For Laravel's usual console output, hand the classes to the seeder yourself with $this->call(Seeder::seeders());.

Generators

Every generator of the framework accepts --module (the make:*-table commands do not: they publish the framework's own migrations, which no module owns):

Files are created inside the module with the module's namespace, including everything a command creates along the way (make:model -mfs keeps the migration, factory and seeder in the module). Without the option the commands behave exactly as they do in a stock application.

Laravel finds factories by naming convention, which does not reach into a module, so the generators link them explicitly: the model gets #[UseFactory(PostFactory::class)] and the factory gets protected $model = Post::class;.

Generated view names are namespaced (view('blog::components.alert')), and models, enums, traits, interfaces and scopes always go to Models, Enums, Concerns, Contracts and Models/Scopes.

Only the application's own modules are written to. --module fails for a module in vendor, or outside the application as a symlinked path repository is, and what such a module provides is published instead.

A generator from another package supports the option once it uses the Laramod\Console\Concerns\TargetsModule trait, provided it extends Laravel's GeneratorCommand.

Publishing

Installed modules are read-only, so what they provide can be copied into the application with the stock vendor:publish:

Tag Copied to
blog-views resources/views/vendor/blog
blog-config config/modules/blog.php
blog-lang lang/vendor/blog
blog-migrations database/migrations
blog-ai .ai/modules/blog

A module only has the tags for what it provides. Published views and translations override the module's, published config wins key by key, and published migrations keep their file names, so they never run twice.

Vite

laramod-vite-plugin builds the entries the modules declare, reloads the page when module views or routes change and adds an @<module> alias for every module.

A module declares its entries relative to itself and loads them the same way, so a view works wherever the module is installed:

Modules::vite() returns what @vite returns. In Vite's manifest an entry is named by its path from the project root, Modules/Blog/resources/js/app.js or vendor/acme/blog/resources/js/app.js, and the application's own views may use that path with the stock @vite directive. Loading an entry the module does not declare is an error, because the dev server would serve it while the build would not contain it.

The JavaScript of an installed module can only import npm packages the application has installed itself.

AI workflow

A module carries its guidance for AI agents in its own ai-workflow directory: README.md is the entry point and workflows/*.md hold step-by-step guides. There are no AGENTS.md or CLAUDE.md files inside modules.

With Laravel Boost, select protibimbok/laramod when boost:install lists third-party guidelines. The application's agent is then told to run laramod:list --json and to read a module's workflow before changing the module or using its classes. An application can override the guidance of an installed module with vendor:publish --tag=blog-ai.

Commands

Command
laramod:init Prepare the application for modules
laramod:list List the modules with what they provide, their publish tags and their AI workflow. --json for tools
laramod:vite The JSON laramod-vite-plugin reads
make:module {name} Create a module, --api, --plain, --order=
make:* --module={name} Create a file inside a module

Configuration

config/laramod.php:

Key Default
path Modules Directory of the application's own modules, relative to the base path
namespace Modules Root namespace that directory is autoloaded under
routes.web ['middleware' => ['web']] Group attributes of ProvidesRoutes
routes.api ['prefix' => 'api', 'middleware' => ['api']] Group attributes of ProvidesApiRoutes

Testing

License

Laramod is open-sourced software licensed under the MIT license.


All versions of laramod with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^13.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 protibimbok/laramod contains the following files

Loading the files please wait ...