Commander Helps developers to generate nextjs code to increase the development process faster.
It is only for developers to use
- How to Install Commander.
- Explore the Commander Commands.
- Understand the Architecture.
- Contributors.
- Clone this repository
git clone https://github.com/saifur-rahman-hasan/commander.git commander
- Make sure you have installed php and composer based on your OS
- Install the composer.json
composer install
Configure your Commander input, output and stub files path if needed.
// config/commander.php
<?php
$commanderInputPath = "CommanderInput";
$commanderOutputPath = "CommanderOutput";
$commanderInputStbFilesPath = "CommanderInput/stubFiles";
return [
'stub_files_path' => base_path($commanderInputStbFilesPath),
'commander_input_path' => base_path($commanderInputPath),
'commander_output_path' => base_path($commanderOutputPath),
'core_path' => base_path("$commanderInputStbFilesPath/core"),
'service_path' => base_path("$commanderOutputPath/services"),
'app_path' => base_path("$commanderOutputPath/app"),
'api_path' => base_path("$commanderInputStbFilesPath/app/api"),
'api_input_path' => base_path("$commanderInputStbFilesPath/app/api"),
'api_output_path' => base_path("$commanderOutputPath/app/api")
];
php artisan commander:init
php artisan commander:make-service
php artisan commander:make-controller
php artisan commander:make-curd-controller
php artisan commander:make-action
php artisan commander:make-repository
php artisan commander:make-interface
php artisan commander:make-api-route
service/
|-- controllers/
| |-- UserController.ts
| |-- AuthController.ts
| |-- AdminUserController.ts
|-- models/
| |-- User.ts
| |-- Role.ts
| |-- Permission.ts
| |-- UserAccessControl.ts
|-- interfaces/
| |-- DefaultInterfaces.d.ts
| |-- UserInterfaces.d.ts
| |-- AuthorizationInterfaces.d.ts
|-- repositories/
| |-- UserRepository.ts
| |-- AdminUserRepository.ts
| |-- RoleRepository.ts
| |-- PermissionRepository.ts
| |-- UserAccessControlRepository.ts
| |-- ...
|-- actions/
| |-- UserCreateAction.ts
| |-- UserUpdateAction.ts
| |-- UserDeleteAction.ts
|-- views/
| |-- pages/
| | |-- LoginPage.tsx
| | |-- RegisterPage.tsx
| | |-- ProfilePage.tsx
| | |-- PasswordResetPage.tsx
| | |-- PasswordRecoverPage.tsx
| | |-- ...
| |-- components/
| | |-- FormUserCreate.tsx
| | |-- FormUserUpdate.tsx
| | |-- FormUserDelete.tsx
| | |-- DataTableUserList.ts
| | |-- DataTableRoleList.ts
| | |-- DataTablePermissionList.ts
| | |-- DropdownUserList.ts
| | |-- DropdownRoleList.ts
| | |-- DropdownPermissionList.ts
| | |-- ...
| |-- layouts/
| | |-- layout.tsx
| | |-- template.tsx
| | |-- ...
| |-- interfaces/
| | |-- DefaultInterfaces.d.ts
|-- middleware/
| |-- middleware.ts
|-- hooks/
| |-- useAuth.ts
| |-- useAuthorize.ts
|-- redux-store/
| |-- UserApiSlice.ts
| |-- UserSlice.ts
A service is a modular software component that encapsulates business logic, data handling, and user interface interactions. Comprising controllers for input handling, models for data representation, interfaces for contract definitions, repositories for data access, views for user presentation, middleware for request processing, and hooks for functionality extension, this organized structure enhances code maintainability and enforces the separation of concerns in development.
Controllers are responsible for managing input within a service, orchestrating the flow of data and interactions. They handle user requests, delegate tasks to models and services, and facilitate communication between the user interface and underlying business logic, contributing to a well-organized and structured software architecture.
Repositories manage data access within a service, acting as an intermediary between the application and the data source. They encapsulate database interactions, abstracting away the underlying storage details. Repositories promote code maintainability by centralizing data-related operations and facilitating a consistent interface for data retrieval and manipulation.
Models represent the data and business logic within a service. They define the structure of data entities, encapsulate validation rules, and handle interactions with the underlying database through repositories. Models contribute to a modular and organized codebase, ensuring a clear separation between data representation and application logic.
Interfaces define contracts within a service, specifying the methods and properties that must be implemented by classes. They establish a set of rules for interactions between different components, promoting code consistency and allowing for the creation of interchangeable implementations. Interfaces enhance modularity and enable a more flexible and extensible software architecture.
Views are responsible for presenting data to the user within a service. They represent the user interface components, rendering information from models and facilitating user interactions. Views contribute to the overall organization by separating the presentation layer from the underlying business logic, promoting code clarity and maintainability.
Actions in a service define discrete units of work triggered by events or user interactions. They encapsulate the logic associated with these events, serving as a bridge between user interactions, controllers, and the underlying business logic. Actions contribute to a modular and scalable architecture, facilitating the organization of application behavior.
The store in a service acts as a centralized data repository, managing the application's state. It stores and retrieves data that components across the service can access and modify. The store is a key component in state management, enhancing predictability and maintainability in applications with complex data flows.
Hooks provide a way to extend or modify the behavior of a service by injecting custom functionality at specific points in the application lifecycle. They act as entry points for developers to add their code and customize the service's behavior, promoting flexibility and enabling the creation of reusable and shareable code snippets.
Middleware in a service intercepts and processes requests or events before they reach the core business logic. It enables the implementation of cross-cutting concerns such as logging, authentication, or data transformation. Middleware promotes modular and reusable code by separating these concerns from the main application logic.
Providers are components that supply or manage resources, services, or dependencies across the application. They act as a centralized source for accessing and configuring various services, fostering a clean and organized way to manage dependencies and promote a consistent interface for resource consumption throughout the application.
composer require laravel/sail --dev
alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
php artisan sail:install
sail up
sail up -d
sail stop
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/var/www/html" \
-w /var/www/html \
laravelsail/php82-composer:latest \
composer install --ignore-platform-reqs
Thanks go to these wonderful people (Commander):
Saifur Rahman 💬 📖 👀 📢 |