Link Search Menu Expand Document

Configuration

Table of contents

  1. app.php
  2. database.php
  3. encryption.php
  4. routes.php
  5. custom.php

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:

ItemsDescriptionExamples
Database TypeOnly supports MySQL and MSSQL for nowmysql
HostnameDatabaase IP addresslocalhost
PortDatabaase port address3306
Schema NameSchema name as identifier for multiple databaseprimary
Database NameName of databasesinventory
UsernameUser databasesroot
PasswordPassword databases**
DriverDatabase Drivermysql

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'];