An open API service indexing awesome lists of open source software.

https://github.com/anglesoft/architect

📐 Software architecture library for the Laravel Framework.
https://github.com/anglesoft/architect

architect architecture architecture-library artisan-command laravel laravel-framework php sprint tdd

Last synced: 11 months ago
JSON representation

📐 Software architecture library for the Laravel Framework.

Awesome Lists containing this project

README

          

# Architect
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:

```shell
composer require angle/architect
```

### Run The Architect Installer

To finish the installation process and configure the package, use the ```architect:install``` Artisan command:

```shell
php artisan architect:install
```

## Generating Sprints

To create a sprint, use the ```make:sprint``` Artisan command:

```shell
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
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
```