michaeljennings / laravel-make
An application to make the laravel 'make' commands globally available.
Requires
- php: >=8.0
- laravel/framework: >=9.0
This package is auto-updated.
Last update: 2024-10-16 21:54:22 UTC
README
This package allows you to use the laravel make commands outside of a laravel application, this can be very useful for package development.
Installing Globally
To install the package globally run composer global require michaeljennings/laravel-make
.
When composer has finished installing you should be able to laravel-make
in your command line and it should list all
of the available commands.
If you are on windows and it says laravel-make
is not a function then make sure your global composer .bin directory
is in the $PATH environment variable.
Installing Per Project
To install on a per project basis run composer require michaeljennings/laravel-make
.
Or add the package to you composer.json
file.
{ ... "require-dev": { "michaeljennings/laravel-make": "~1.0", }, ... }
Then run composer update
to install the package.
Once installed run vendor/bin/laravel-make
and you should see a list of all of the available commands.
Configuration
By default the laravel commands try to place the new files within the app
directory and in the App
namespace, however
this is very rarely how a package is setup.
To get around this you can create a .laravel-make
file in the root of your package and define your package specific
configuration in it. This file works like a .env
file, a sample file is below, and then there is a description of each
configuration option underneath.
BASE_PATH=/src
BASE_NAMESPACE=Example\Package
USER_MODEL=Example\Package\Models\User
Base Path
The base path that will be prepended to all files, excluding migrations and seeders.
Defaults to /app
BASE_PATH=/src
Base Namespace
This is the root namespace that will be prepended to each class.
Defaults to 'App'
BASE_NAMESPACE=Example\Package
User Model
This option is a little strange. Some of the stubs need to the path to the user model for the application, by default
laravel tries to find this from the auth config file. As we don't have the auth config file available to us we have
to specify it in the .laravel-make
file.
Defaults to 'App\User'
USER_MODEL=Example\Auth\Models\User
Console Command Path
The path the command files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Console/Commands'
CONSOLE_COMMAND_PATH=src/Commands
Console Command Namespace
The namespace that will be prepended to all console commands.
Defaults to '{BASE_NAMESPACE}\Console\Commands'
CONSOLE_NAMESPACE=Example\Package\Commands
Controller Path
The path the controller files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Http/Controllers'
CONTROLLER_PATH=src/Controllers
Controller Namespace
The namespace that will be prepended to all controllers.
Defaults to '{BASE_NAMESPACE}\Http\Controllers'
CONTROLLER_NAMESPACE=Example\Package\Controllers
Event Path
The path the event files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Events'
EVENT_PATH=src/Events
Event Namespace
The namespace that will be prepended to all events.
Defaults to '{BASE_NAMESPACE}\Events'
EVENT_NAMESPACE=Example\Package\Events
Listener Path
The path the listener files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Listeners'
LISTENER_PATH=src/Listeners
Listener Namespace
The namespace that will be prepended to all listeners.
Defaults to '{BASE_NAMESPACE}\Listeners'
LISTENER_NAMESPACE=Example\Package\Listeners
Mail Path
The path the mail files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Mail'
MAIL_PATH=src/Mail
Mail Namespace
The namespace that will be prepended to all mail classes.
Defaults to '{BASE_NAMESPACE}\Mail'
MAIL_NAMESPACE=Example\Package\Mail
Middleware Path
The path the middleware files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Middleware'
MIDDLWARE_PATH=src/Middleware
Middleware Namespace
The namespace that will be prepended to all middleware classes.
Defaults to '{BASE_NAMESPACE}\Middleware'
MIDDLWARE_NAMESPACE=Example\Package\Middleware
Migration Path
The path the migration files should be stored in. By default this will prepend the base path.
Defaults to 'database/migrations'
MIGRATION_PATH=migrations
Model Path
The path the model files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}'
MODEL_PATH=src/Models
Model Namespace
The namespace that will be prepended to all models.
Defaults to '{BASE_NAMESPACE}\Models'
MODEL_NAMESPACE=Example\Package\Models
Notification Path
The path the notification files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Notifications'
NOTIFICATION_PATH=src/Notifications
Notification Namespace
The namespace that will be prepended to all notifications.
Defaults to '{BASE_NAMESPACE}\Notifications'
NOTIFICATION_NAMESPACE=Example\Package\Notifications
Policy Path
The path the policy files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Policies'
POLICY_PATH=src/Policies
Policy Namespace
The namespace that will be prepended to all policies.
Defaults to '{BASE_NAMESPACE}\Policies'
POLICY_NAMESPACE=Example\Package\Policies
Provider Path
The path the provider files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Providers'
PROVIDER_PATH=src/Providers
Provider Namespace
The namespace that will be prepended to all providers.
Defaults to '{BASE_NAMESPACE}\Providers'
PROVIDER_NAMESPACE=Example\Package\Providers
Request Path
The path the request files should be stored in. By default this will prepend the base path.
Defaults to '{BASE_PATH}/Requests'
REQUEST_PATH=src/Requests
Request Namespace
The namespace that will be prepended to all requests.
Defaults to '{BASE_NAMESPACE}\Requests'
REQUEST_NAMESPACE=Example\Package\Requests
Seeder Path
The path the seeder files should be stored in. By default this will prepend the base path.
Defaults to 'database/seeds'
SEEDER_PATH=seeds