Download the PHP package tuum/builder without Composer
On this page you can find all versions of the php package tuum/builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package builder
Short Description a generic builder for PHP application based on environment.
License MIT
Informations about the package builder
Application Builder
A generic builder for application construction based on various server environment.
Licence
MIT License
PSR
PSR-1, PSR-2, and PSR-4.
Installation
Sample Code
Basic Usage
Directory Structure
Tuum/Builder
assumes there are two directories to build an application:
APP_DIR
: directory for application settings, andVAR_DIR
: directory for files not under version control.
For instance,
Construction
Construct the application builder with two directories:
Or, simply use forge
method as shown in the Sample Code Section.
Loading PHP File
To load configuration files under the APP_DIR
, use load
method as;
In setup.php
file, set up the application, such as:
- The builder has
has
,get
, andset
methods as expected. - There are
setApp()
andgetApp()
methods to store your application. - The returned value from the PHP files are stored in the builder
using its load name, which can be accessed by:
$builder->get('setup');
.
Getting Values
The get
method tries to get value from:
- environment value,
$builder
's internal value- default value.
Environment File
Loads .env
file using vlucas's dotenv component.
The default location of the .env
file is at VAR_DIR
.
The .env
file contains APP_ENV
key to specify the environment as such;
Then, you can access the environment as,
The builder considers the environment as prod
if no environment is set, or no environment file to load.
To change the key string used to specify the environment,
set Builder::APP_KEY
value to the new key name, such as;