Download the PHP package lifespikes/laravel-bare without Composer
On this page you can find all versions of the php package lifespikes/laravel-bare. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-bare
Laravel Bare
Component of lifespikes/lifespikes
A very minimalist and customizable Laravel installation. Ideal for customizing Laravel path
resolutions and discovering service providers when working with a monorepo using
symplify/monorepo-builder
- Getting Started
- Installation
- Usage
- Configuration
- Registering Packages
- Building Apps on Bare
- FAQ
- Where is the [X] directory?
- Why should I use Bare?
Installation
Setting up Bare is a bit different from a regular Laravel installation:
- No boilerplate/skeleton code
- Purely service-provider driven
- Bootstrap and other startup code is not included
You'll need to start by of course, installing the module:
composer require @lifespikes/laravel-bare
Then, your entrypoint needs to be set up. You will need to create an entrypoint for artisan and another one for your web app if applicable:
Setting up your web entrypoint is essentially the same:
Usage
There's no special configuration or usage for Bare besides its path
configuration and monorepo-builder
support.
Customizing Directories
The bare()
bootstrap helper takes a base path as its first argument. However,
you can also pass an array of paths that Laravel will use as values when trying
to resolve against path instances like resource_path
, database_path
, etc.
Defaults can be found in the config/paths.php
file.
Local Package Discovery
If you have built Laravel packages in the past, you're probably familiar
with the {"extra": {"laravel": {...}}}
section of your composer.json file.
However, using this section in your standard, root-level composer.json file
will have no effect, since Laravel reads off your vendor/composer/installed.json
manifest when performing package discovery.
Bare adds a bit of logic during registration to allow local packages like these to be discovered without having to manually register them against the container instance.
This is especially helpful when building monorepo where you may have multiple Laravel packages you wish to isolate.
Read more about package discovery.
Building Apps on Bare
Bare is meant to be used as a base for building package-driven SOLID codebases. This means you'll have to write your own service providers and bootstrap code as explained earlier. Primarily, for example, we use bare as a simple way for us to write modularized, independent packages that make up a large app. The Laravel documentation is a great place to start:
https://laravel.com/docs/9.x/packages
FAQ
Where is the [X] directory?
Bare allows you to use Laravel as a library. It contains all the default
configurations found in the laravel/laravel
scaffold, but removes all dependencies
in the App\
namespace.
You'll need to use service providers to manually bind config, events, listeners, etc. to your module.
If you're wondering why we did this, read the section below.
Why go Bare?
When people think about Laravel, they usually think of two things:
- A web framework
- The
laravel/laravel
repository
Most people are unaware that these terms are exclusive of each other. The
components that make up the framework are actually contained in the
laravel/framework
repository.
Libraries have historically been published by the maintainer, and then implemented by the developer. Maintainer code is not present in the app's codebase. This pattern is often seen in low-level languages like C, C++, ASM, etc. (OpenSSL, SDL, Vulkan, OpenGL, are good examples)
This project is intended for developers with an architectural background looking to harness the power of Laravel, while maintaining the freedom to implement their own structures and patterns.