Download the PHP package karnoweb/laravel-module-manager without Composer

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

Laravel Module Manager

A module/feature-flag system for Laravel with dependency resolution, tree structure, system (locked) modules, and Laravel 10–12 support.

For usage scenarios and examples in Persian (فارسی), see سناریوهای کاربردی.

Requirements

Installation

Publish config and migrations:

Configuration

Edit config/module-manager.php:

Key Description
table_prefix Optional prefix for tables (e.g. mm_mm_modules)
tables.modules Modules table name
tables.dependencies Dependencies table name
migration_prefix Prefix for published migration filenames
cache.enabled Enable cache for active status
cache.ttl Cache TTL (seconds)
cache.prefix Cache key prefix
default_deactivation cascade, restrict, or none
events.enabled Fire module events
modules Array of module definitions (see below)

Defining modules in config

Add modules under modules so they can be synced with php artisan module:sync. You can use a nested structure with records: children inherit group and get parent set automatically.

Nested (recommended):

Flat: same keys at top level; set group and parent on each module.

Sync from config:


API Reference

Status checks

Method Description
Module::active(string\|array $keys) Returns true if module(s) are active
Module::inactive(string $key) Returns true if module is inactive
Module::allActive(array $keys) All given keys must be active
Module::someActive(array $keys) At least one key active

Conditional execution

Method Description
Module::when(string $key, Closure $active, ?Closure $inactive = null) Run callback by status
Module::unless(string $key, Closure $callback) Run callback when inactive

Activation / deactivation

Method Description
Module::activate(string $key) Activate module (throws on missing deps / conflicts)
Module::deactivate(string $key) Deactivate (throws for system modules or active dependents)
Module::toggle(string $key) Toggle active state; returns new state

Validation

Method Description
Module::canActivate(string $key) Whether activation is allowed
Module::canDeactivate(string $key) Whether deactivation is allowed
Module::whyCantActivate(string $key) Reasons (e.g. missing_dependencies, conflicts)
Module::whyCantDeactivate(string $key) Reasons (e.g. system_module, active_dependents)

Dependencies

Method Description
Module::requires(string $module, string $dependency) Add required dependency
Module::conflicts(string $module, string $conflictsWith) Add conflict (bidirectional)
Module::suggests(string $module, string $suggestion) Add suggestion
Module::getDependencies(string $key) Get required modules
Module::getDependents(string $key) Get modules that require this one

Tree

Method Description
Module::tree(?string $group = null) Nested tree (with children)
Module::children(string $key) Direct children
Module::descendants(string $key) All descendants
Module::ancestors(string $key) All ancestors
Module::siblings(string $key) Siblings

Metadata

Method Description
Module::meta(string $key, string $metaKey, mixed $default = null) Get metadata value
Module::setMeta(string $key, string\|array $metaKey, mixed $value = null) Set metadata

Management

Method Description
Module::define(string $key, string $name, array $options = []) Create or update module
Module::all() All modules (ordered)
Module::groups() List of groups
Module::group(string $group) Modules in group
Module::find(string $key) Find by key or null
Module::findOrFail(string $key) Find or throw
Module::flushCache() Clear active-status cache

Helpers

Function Description
module(?string $key = null) Manager instance or active($key)
module_active(string\|array $keys) Same as Module::active()
module_inactive(string $key) Same as Module::inactive()
module_meta(string $key, string $metaKey, mixed $default = null) Same as Module::meta()
when_module(string $key, Closure $active, ?Closure $inactive = null) Same as Module::when()

Artisan commands

Command Description
php artisan module:list List modules (--group=, --active, --inactive)
php artisan module:activate {key} Activate a module
php artisan module:deactivate {key} Deactivate a module
php artisan module:tree Show tree (--group=, --json)
php artisan module:sync Sync modules from config (--force to skip confirm)

Usage examples

Check and run code by module

Blade

Routes and middleware

Define modules and dependencies in code

System (locked) modules

Set is_system => true in config or when defining. System modules cannot be deactivated via Module::deactivate() or module:deactivate (throws SystemModuleException).

Sync from config in app seeder


Exceptions

Exception When
ModuleNotFoundException Module key not found
DependencyException Missing deps or active dependents block action
ConflictException Conflicting module is active
CircularDependencyException Circular requires detected
SystemModuleException Deactivate attempted on system module

License

MIT.


All versions of laravel-module-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database 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 karnoweb/laravel-module-manager contains the following files

Loading the files please wait ...