angle / architect
Agile development suite for Laravel.
This package is auto-updated.
Last update: 2025-01-12 06:41:41 UTC
README
Software architecture library for the Laravel Framework.
Introduction
Architect provides an expressive way to organize and generate boilerplate classes that will hold your application's business logic. The goal of this package is to implement a component-oriented back-end architecture. By using decoupled components, you may reuse parts of your code accross multiple services (Controllers and various API endpoints).
Architect will create tests for each classes it generates, encouraging a Test-Driven Development approach within your team.
Installation
Composer
First, add the Architect package to your dependencies:
composer require angle/architect
Run The Architect Installer
To finish the installation process and configure the package, use the architect:install
Artisan command:
php artisan architect:install
Generating Sprints
To create a sprint, use the make:sprint
Artisan command:
php artisan make:sprint "Create new user"
The new sprint will be placed in your sprints
directory (you can set it either during installation, either by editing config/architect.php
). Each sprint file name contains a timestamp which allows Laravel to determine the order of the sprints.
Sprint Structure
A sprint class contains one method: run. This method is used to generate new features, tasks, and tests for each of these.
Within this method you may use the Architect code Blueprint to expressively create new classes.
<?php use Angle\Architect\Sprint; use Angle\Architect\Code\Blueprint; use Angle\Architect\Facades\Architect; class CreateNewUserSprint extends Sprint { /** * Runs the sprint. * * @return void */ public function run() { Architect::feature('Create new user', function (Blueprint $code) { $code->task('validate request')->expect('request')->return('is valid'); $code->task('save user')->expect('request')->return('user'); $code->task('send email to administrators')->expect('user'); }); } }
Running Sprints
To run all of your sprints, execute the sprint
Artisan command:
php artisan sprint
Pretending To Run Sprints
You can safely test your sprint by running the sprint
Artisan command with the --pretend
option:
php artisan sprint --pretend
Forcing Sprints To Overwrite Existing Files
You can force the overwriting of existing files by running the sprint
Artisan command with the --force
option:
php artisan sprint --force
Rolling Back Sprints
Just like you do with Laravel Migrations, you can rollback sprints. This will remove any file generated by the last batch. Note: you can also append the --pretend
option in order to preview changes.
php artisan sprint:rollback