Download the PHP package lucid-arch/laravel-microservice without Composer

On this page you can find all versions of the php package lucid-arch/laravel-microservice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-microservice

Lucid • Microservice - Laravel

With the emerging need for separation per concern, microservices emerged to be the trending progression of what used to be a monolithic application. Especially with Lucid, scale is one of the core concerns that a microservice is the natural progression of the architecture from its monolithic counterpart.

It is no coincidence that the different parts of a Lucid monolithic application are called a Service, for microservices are indeed the next progression when applications scale and reach that turning point. Having implemented your application using Lucid, the transition process will be logically simpler to think about and physically straight-forward to implement.

To see how it compares to the monolithic application and when to use which, check Monolith vs. Microservice

Join The Community on Slack

Slack Status

The Lucid Architecture for Building Scalable Applications - Laracon EU 2016

Check out my talk at LaraconEU 2016 where I introduce the concept and application of the Lucid architecture: Abed Halawi - The Lucid Architecture for Building Scalable Applications

Installation

To get rolling, you need to create a new project using Composer:

Getting Started

This project ships with the Lucid Console which provides an interactive user interface and a command line interface that are useful for scaffolding and exploring Services, Features and Jobs.

Setup

The lucid executable will be in vendor/bin. If you don't have ./vendor/bin/ as part of your PATH you will need to execute it using ./vendor/bin/lucid, otherwise add it with the following command to be able to simply call lucid:

For a list of all the commands that are available run lucid or see the CLI Reference.

1. Create a Feature

This is the Feature that we will be serving when someone visits our /users route.

2. Create a Job

This Job will fetch the users from the database and will be used inside our Feature to serve them.

Open the file that was generated at app/Domains/User/GetUsersJob.php and edit the handle method to this:

In a real-world application you might want to fetch the users from a database, and here is the perfect place for that. Here's an example of fetching a list of users and providing the ability to specify the limit:

NOTE: The namespace for models is [app namespace]\Data\Models

3. Run The Job

The RespondWithJsonJob is one of the Jobs that were shipped with this project, it lives in the Http domain and is used to respond to a request in structured JSON format.

4. Serve The Feature

To be able to serve that Feature we need to create a route and a controller that does so.

Generate a plain controller with the following command

And we will have our UserController generated in app/Http/Controllers/UserController.php which we will use to serve our Feature in its index method.

We just need to create a route that would delegate the request to our index method:

In routes/web.php add:

That's it! Now serve the application with php artisan serve and visit http://localhost:8000/users

Event Hooks

Lucid exposes event hooks that allow you to listen on each dispatched feature, operation or job. This is especially useful for tracing:


Monolith vs. Microservice

In the monolith Lucid application we have multiple services (i.e. Api, Web) and these typically will exist in src/Services/Api and src/Services/Web respectively. With the microservice the src does not exist, since it is intended to be one service serving a single purpose, the app directory will do. It will hold the following directories:

Directory Structure

Component Monolith Microservice
Job src/Domains/[domain]/Jobs/[job] app/Domains/[domain]/Jobs/[job]
Feature src/Services/[service]/Features/[feature] app/Features/[feature]
Service src/Service/[service] N/A (app) as equivalent

Tests

One other significant difference is in the location of tests:

Component Monolith Microservice
Job src/Domains/[domain]/Tests/Jobs/[JobTest] tests/Domains/[domain]/Jobs/[JobTest]
Feature src/Services/[service]/Tests/Features/[FeatureTest] tests/Features/[Feature]Test.php

How To Choose

It is always recommended that you start with a monolith and work on it until it gets so big that it is crucial to be dissected into single-purpose services (microservices). It would be challenging to be able to figure out the different services your application would need moving forward.

This project is also useful when you know for sure that your application will not have to deal with multiple Services but you would still like to use Lucid.


All versions of laravel-microservice with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
fideloper/proxy Version ^4.2
fruitcake/laravel-cors Version ^1.0
guzzlehttp/guzzle Version ^7.0.1
laravel/framework Version ^8.0
laravel/tinker Version ^2.0
lucid-arch/laravel-foundation Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lucid-arch/laravel-microservice contains the following files

Loading the files please wait ....