Installation

Install Laravel

The Lucid Architecture is delivered as a Composer package lucidarch/lucid. Its only requirement is a Laravel project so to begin the installation, first grab a Laravel instance by simply running

composer create-project --prefer-dist laravel/laravel blog

Or head over to Laravel’s Installation docs for other means of installation.

Install Lucid

composer require lucidarch/lucid

Make sure to place Composer’s project vendor bin direcotry in your $PATH so the lucid executable can be located by your system. Usually it’s done by running export PATH="$PATH:./vendor/bin" to have it available in your current Terminal session, or add it to your corresponding Terminal profile (e.g. ~/.bashrc, ~/.bash_profile, ~/.zshrc) to have it permanently loaded with every session.

Versions & Compatibility

Lucid’s versioning system follows the semantic versioning scheme. The latest Lucid version is tested against the following matrix, hence providing support to any combination of them:

  • Laravel 8 7 6 5.5 (LTS)

  • PHP: 8.0 7.4 7.3 7.2 7.1 7.0.21

Initialization

Lucid structure initialization is an optional step. If you’ve required the package you may already begin using lucid executable to generate units such as Jobs, Features and Operations.

However, if you’ve familiarized yourself with the predefined variants of Lucid - Micro and Monolith - you may wish to initialize your application.

Micro

Initialize a Micro instance:

lucid init:micro

This will generate an initial Micro structure:

app
├── Console
│   └── Kernel.php
├── Data
    └── Models
├── Domains
├── Features
├── Operations
├── Exceptions
│   └── Handler.php
├── Http
│   ├── Controllers
│   ├── Kernel.php
│   └── Middleware
├── Policies
└── Providers
    ├── AppServiceProvider.php
    ├── AuthServiceProvider.php
    ├── BroadcastServiceProvider.php
    ├── EventServiceProvider.php
    └── RouteServiceProvider.php

Monolith

Initialize a Monolith instance:

lucid init:monolith
app
├── Console
├── Data
    └── Models
├── Domains
├── Exceptions
├── Foundation
├── Http
├── Policies
├── Providers
├── Services
├── artisan
├── bootstrap
├── composer.json
├── composer.lock
├── config
├── database
├── package.json
├── phpunit.xml
├── public
├── resources
├── routes
├── server.php
├── storage
├── tests
└── webpack.mix.js

You may also specify a service to begin with:

lucid init:monolith blog

And the following will be added to the initial structure:

app/Services/Blog
├── Console
│   └── Commands
├── Features
├── Operations
├── Http
│   ├── Controllers
│   └── Middleware
├── Providers
│   ├── BlogServiceProvider.php
│   ├── BroadcastServiceProvider.php
│   └── RouteServiceProvider.php
├── database
│   ├── factories
│   ├── migrations
│   └── seeds
├── resources
│   ├── lang
│   └── views
└── routes
    ├── api.php
    ├── channels.php
    ├── console.php
    └── web.php

For more on the difference between Micro & Monolith and to know how to choose precisely for your application, head over to Micro • Monolith.


That’s it! You’re ready to build something awesome.

One last thing to remember: enjoy the journey!