### Vendor Commands with Module Support (Livewire Example)
Source: https://github.com/internachi/modular/blob/main/README.md
Demonstrates how the --module option can be extended to third-party packages, using Livewire's 'make:livewire' command as an example. This allows for module-specific generation of Livewire components.
```php
php artisan make:livewire counter --module=[module name]
```
--------------------------------
### Install InterNACHI Modular Package
Source: https://github.com/internachi/modular/blob/main/README.md
Installs the internachi/modular package using Composer. Laravel's auto-discovery handles the setup.
```shell
composer require internachi/modular
```
--------------------------------
### Composer Path Repository Configuration
Source: https://github.com/internachi/modular/blob/main/README.md
Example of how a module is registered as a path repository in the main project's composer.json file, enabling Composer's autoloading for the module.
```json
{
"repositories": [
{
"type": "path",
"url": "./app-modules/my-module"
}
],
"require": {
"modules/my-module": "*"
}
}
```
--------------------------------
### Blade Component Registration and Usage
Source: https://github.com/internachi/modular/blob/main/README.md
Explains how Laravel Blade components within modules are automatically registered under a component namespace. Provides examples of how to reference these components in Blade templates based on their file structure.
```blade
```
--------------------------------
### Translation Registration and Usage
Source: https://github.com/internachi/modular/blob/main/README.md
Details how Laravel Translations are automatically registered under a component namespace. Shows an example of accessing translations from a module's language files using the __() helper function with the module's namespace.
```text
__('demo::messages.welcome');
```
--------------------------------
### Package Helper Commands
Source: https://github.com/internachi/modular/blob/main/README.md
Provides essential helper commands for managing modules within the package, such as scaffolding new modules, caching, clearing cache, syncing configurations, and listing all available modules.
```php
php artisan make:module
php artisan modules:cache
php artisan modules:clear
php artisan modules:sync
php artisan modules:list
```
--------------------------------
### Create a New Module
Source: https://github.com/internachi/modular/blob/main/README.md
Scaffolds a new module with a predefined directory structure including composer.json, src, tests, routes, resources, and database folders. It also updates the project's composer.json to include the new module.
```shell
php artisan make:module my-module
```
--------------------------------
### Laravel Make Commands with Module Support
Source: https://github.com/internachi/modular/blob/main/README.md
Extends most of Laravel's standard 'make:' commands with a --module option, allowing developers to scaffold various components (controllers, models, etc.) directly within a specified module. This leverages existing Laravel tooling and custom stubs.
```php
php artisan make:cast MyModuleCast --module=[module name]
php artisan make:controller MyModuleController --module=[module name]
php artisan make:command MyModuleCommand --module=[module name]
php artisan make:component MyModuleComponent --module=[module name]
php artisan make:channel MyModuleChannel --module=[module name]
php artisan make:event MyModuleEvent --module=[module name]
php artisan make:exception MyModuleException --module=[module name]
php artisan make:factory MyModuleFactory --module=[module name]
php artisan make:job MyModuleJob --module=[module name]
php artisan make:listener MyModuleListener --module=[module name]
php artisan make:mail MyModuleMail --module=[module name]
php artisan make:middleware MyModuleMiddleware --module=[module name]
php artisan make:model MyModule --module=[module name]
php artisan make:notification MyModuleNotification --module=[module name]
php artisan make:observer MyModuleObserver --module=[module name]
php artisan make:policy MyModulePolicy --module=[module name]
php artisan make:provider MyModuleProvider --module=[module name]
php artisan make:request MyModuleRequest --module=[module name]
php artisan make:resource MyModule --module=[module name]
php artisan make:rule MyModuleRule --module=[module name]
php artisan make:seeder MyModuleSeeder --module=[module name]
php artisan make:test MyModuleTest --module=[module name]
```
--------------------------------
### Publish Modular Configuration
Source: https://github.com/internachi/modular/blob/main/README.md
Publishes the package's configuration file to allow customization of the default module namespace. This is recommended for better organization.
```shell
php artisan vendor:publish --tag=modular-config
```
--------------------------------
### Module Auto-Discovery Features
Source: https://github.com/internachi/modular/blob/main/README.md
Details the automatic integration of modules with Laravel's core features, including Artisan commands, migrations, factories, policies, Blade components, and event listeners.
```markdown
- Commands are auto-registered with Artisan
- Migrations will be run by the Migrator
- Factories are auto-loaded for `factory()`
- Policies are auto-discovered for your Models
- Blade components will be auto-discovered
- Event listeners will be auto-discovered
```
--------------------------------
### Synchronize Module Configurations
Source: https://github.com/internachi/modular/blob/main/README.md
Synchronizes project configurations for module support, including adding a 'Modules' test suite to phpunit.xml and updating PhpStorm's Laravel plugin configuration for module view discovery. This command is safe to run anytime and can be added to post-autoload-dump scripts.
```shell
php artisan modules:sync
```
--------------------------------
### Module Generation Placeholders
Source: https://github.com/internachi/modular/blob/main/README.md
This snippet lists the available placeholders that can be used within filenames and file contents when generating new modules. These placeholders allow for dynamic customization of generated module files.
```PHP
StubBasePath
StubModuleNamespace
StubComposerNamespace
StubModuleNameSingular
StubModuleNamePlural
StubModuleName
StubClassNamePrefix
StubComposerName
StubMigrationPrefix
StubFullyQualifiedTestCaseBase
StubTestCaseBase
```
--------------------------------
### Other Laravel Commands with Module Support
Source: https://github.com/internachi/modular/blob/main/README.md
Adds the --module option to the 'db:seed' command, enabling seeding of database tables specifically within a designated module. This includes options for seeding the default database seeder or a specific seeder class within the module.
```php
php artisan db:seed --module=[module name]
php artisan db:seed --class=MySeeder --module=[module name]
```
--------------------------------
### Update Composer Dependencies
Source: https://github.com/internachi/modular/blob/main/README.md
Updates Composer dependencies, specifically including the newly created module. This ensures that the module is properly recognized and autoloaded.
```shell
composer update modules/my-module
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.