Configuration
Table of contents
All of configuration needed is already bind into .env
file, but if you want to control more configuration in your workflow, all file is grouped together in one directory. View via github repo site’s config as an example.
app.php
App config/app.php
used to hold read-only variable and later can retrieved in controller for usages. App file structured as PHP array and consists 3 root identifier const
, cache
and logs
.
- const
You can register your constant in const
sections of file. For example:
<?php return [
'const' => [
'API' => 'https://localhost:3000/api/',
]
...
];
- cache
By default, Puko Framework utilize memcached as cache driver. You can configure the connection settings here.
<?php return [
...
'cache' => [
'kind' => 'MEMCACHED',
'expired' => 100,
'host' => 'localhost',
'port' => 11211,
]
...
];
cache implementation coming soon
- logs
Puko utilize logs as a custom hook with build in Slack Incoming WebHooks for error reporting, by default set to false. If you have slack accounts, you can setup a Incoming WebHook URL and paste it in Slack url. Then in the Puko Framework Slack section, set the active
state to true
.
custom logs is coming soon
database.php
Database configurations located at config/database.php
folder. You can specify more than one connection because puko uses schema name for each connection string. Puko also scaffolds database configuration process with pukoconsole
tools included as dev-dependency.
as version 1.1.6 puko only supports MySQL and MSSQL database engine
php puko setup db
or if you only refresh the database (without re-write the database configuration): php puko refresh db
Items asked:
Items | Description | Examples |
---|---|---|
Database Type | Only supports MySQL and MSSQL for now | mysql |
Hostname | Databaase IP address | localhost |
Port | Databaase port address | 3306 |
Schema Name | Schema name as identifier for multiple database | primary |
Database Name | Name of databases | inventory |
Username | User databases | root |
Password | Password databases | ** |
Driver | Database Driver | mysql |
At the end wizard is asking for another connection you can answer with y/n
You can refer to database section for detailed information.
encryption.php
Encryption required to secure many aspects in our applications. Puko framework mostly using this to secure user authentication data in several forms. Sessions, Cookies, and Bearer. Puko can scaffolds this process with pukoconsole
tools included as dev-dependency.
Puko using AES-256-CBC as encryption algorithms
To start configure Encryption, you can type in console/terminal/powershell:
php puko setup secure
routes.php
Routes located in config/routes.php
and holds all routing information. This file supposed as read-only because most of the puko routing done with pukoconsole
tools included as dev-dependency.
See Routing for more information.
custom
.php
Puko framework can also create custom config file. for example if you want to add RabbitMQ message queue you can create new config/rabbitmq.php
file
<?php return [
'username' => 'administrator',
'password' => '*******',
'host' => '192.16.60.31',
'port' => '5678'
];
note: Custom <file>.php
is available trough app lifecycles via Config::Data('<file>')
. Which will allow for more control and expansion of all the functionality of the framework itself.
You can retrieve the value with this code snippet:
//initialize config skeleton
$config = pukoframework\config\Config::Data('rabbitmq');
//retrieve the value
$config['username'];
$config['password'];
$config['host'];
$config['port'];