This repository contains a Makefile
designed to streamline the development workflow for Laravel projects. This file provides various commands to automate repetitive tasks, from setting up the environment to managing Laravel-specific functionalities like creating models, controllers, components, and more.
Ensure that your environment has the following dependencies installed:
- PHP
- Composer
- Node.js and npm
To use the Makefile, you must have make
installed. On Unix-based systems, make
is usually pre-installed. For Windows, you may need to install a compatible version of make
.
These commands help set up your Laravel project by installing dependencies and configuring initial settings.
make install
- Install dependencies (Composer and npm) and set up the database.make serve
- Start the development server.make migrate
- Run database migrations.make seed
- Run the database seeder.make fresh
- Refresh all migrations and seed the database.make dev
- Run npm in development mode.make build
- Run npm in production mode.
These commands are used to clear caches, optimize configurations, and run tests.
make clear
- Clear all application caches (config, route, view).make optimize
- Cache and optimize configuration and routes.make test
- Run PHPUnit tests.make clean
- Clean temporary files and caches. This command removes thevendor
,node_modules
, and various cache files to ensure a fresh start for the application.make fresh
- Reset all migrations and seed the database. This command drops all tables and re-runs all migrations, followed by seeding the database with initial data.
The Makefile includes shortcuts for creating Laravel files, such as models, controllers, components, services, etc. Each command follows a similar format, allowing for a consistent and efficient workflow.
make model n=<ModelName> o=<options>
- Create a model with optional migration, seeder, and factory files.
make controller n=<ControllerName> o=<options>
- Create a controller with optional API or resource configuration.make component n=<ComponentName>
- Create a Blade component.
make migration n=<MigrationName> o=<options>
- Create a migration file.make seeder n=<SeederName>
- Create a seeder file.make request n=<RequestName>
- Create a request file.make event n=<EventName>
- Create an event file.make listener n=<ListenerName>
- Create a listener file.make job n=<JobName>
- Create a job file.make mail n=<MailName>
- Create a mailable file.make notification n=<NotificationName>
- Create a notification file.make policy n=<PolicyName>
- Create a policy file.make middleware n=<MiddlewareName>
- Create a middleware file.make factory n=<FactoryName>
- Create a factory file.make rule n=<RuleName>
- Create a custom validation rule.make resource n=<ResourceName> o=<options>
- Create a resource file with optional collection.
make service n=<ServiceName>
- Create a service class in theServices
directory.make helper n=<HelperName>
- Create a helper class in theHelpers
directory.
make class n=<ClassName>
- Create a generic class.make view n=<ViewName>
- Create a view file.make interface n=<InterfaceName>
- Create an interface file.
To run a command, use the following format in your terminal:
make <command> n=<Name> o=<options>