Download the PHP package albaraa/aztec without Composer
On this page you can find all versions of the php package albaraa/aztec. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download albaraa/aztec
More information about albaraa/aztec
Files in albaraa/aztec
Package aztec
Short Description Automatic CRUD generator for Laravel modules
License MIT
Informations about the package aztec
Aztec - Advanced Layered CRUD Generator for Laravel
Introduction
Aztec is a powerful Laravel package designed to automate the generation of a clean, layered architecture for your application modules. It goes beyond simple CRUD generation by implementing a robust Service-Repository pattern, ensuring your controllers remain thin and your business logic is well-encapsulated.
Installation
You can install the package via composer:
Features
- Layered Architecture: Generates Controller, Service, Repository (Interface & Implementation), API Resource, and Form Requests.
- Module Support: Designed to work intimately with modular structures (e.g.,
Modules/Blog). - Interactive Generation: CLI prompts guide you through selecting relationships for resources, adding custom filters, and configuring relation syncing.
- Smart Validation: Automatically builds validation rules and translation keys (e.g.,
validations.module.field.rule) based on your model's attributes and casts. - Automatic Wiring: Automatically binds repositories in your Module's ServiceProvider and appends routes to
web.php.
Usage
Generating CRUD
The main entry point is the aztec:make-crud command. It requires the Module name and the Model name (which must already exist).
Example:
To generate CRUD for a Post model inside the Blog module:
The Generation Flow
When you run the command, Aztec performs the following steps:
- Analysis: It inspects your Model file to understand its fillable attributes, casts, and relationships.
- Interactive Configuration:
- Resources: It asks which relationships should be included in the API Resource.
- Service Layer: It prompts you to add custom filters for the listing endpoint (e.g., filter by status, type, etc.) and asks which relationships should be synced automatically during create/update operations.
- File Generation:
- Repository: Generates
PostRepositoryInterfaceandEloquentPostRepository. It checksBlogServiceProviderand binds the interface to the implementation automatically. - Service: Generates
PostServicecontaining business logic. It handles pagination, search (smartly guessing searchable fields), custom filtering, and transaction-wrapped CRUD operations. - Requests: Generates
PostStoreRequestandPostUpdateRequestwith rules inferred from your model. It also generates amessages()method returning code-based keys (e.g.,validations.blog.title.required) for frontend localization. - Controller: Generates
PostControllerwhich injects thePostService. It remains clean and acts only as a gateway. - Resource: Generates
PostResourceto format the JSON response. - Routes: Appends standard RESTful routes to
Modules/Blog/routes/web.phpwith a clean group structure.
- Repository: Generates
Directory Structure Idea
Assuming a Blog module and Post model, Aztec creates/updates:
Customization
You can customize the available layers and generation behavior by publishing the config file (if available):
Crafted for developers who value clean code and speed.
All versions of aztec with dependencies
illuminate/support Version ^12.0
illuminate/console Version ^12.0
illuminate/filesystem Version ^12.0
nikic/php-parser Version ^5.7
doctrine/dbal Version ^4.4