PHP code example of davestewart / pathconfig

1. Go to this page and download the library: Download davestewart/pathconfig library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

davestewart / pathconfig example snippets


return array
(
    'app'       => 'app',
    'config'    => 'resources/config',
    'storage'   => 'storage',
);

$paths = pathconfig\PathConfig::instance()->load();

$app = new pathconfig\apps\Laravel50();

$config = $paths->get('config');

//  /home/vagrant/code/project.app/support/config/

$file = $paths->get('config', 'path/to/file.php');

//  /home/vagrant/code/project.app/support/config/path/to/file.php

$file = $paths->get('path/to/file/from/root.php');

//  /home/vagrant/code/project.app/path/to/file/from/root.php

$root = $paths->get();

//  /home/vagrant/code/project.app/

$root = $paths->all();

//  Array
//  (
//      [base] => /home/vagrant/code/project.app
//      [app] => /home/vagrant/code/project.app/app
//      [public] => /home/vagrant/code/project.app/public
//      [routes.php] => /home/vagrant/code/project.app/app/Http/routes.php
//  )

$paths->set('plugins', 'support/plugins/');

$paths->option('base', $value);

$paths->option('convertslashes', true);

$paths->option('trimslashes', false);

$paths->option('testpaths', true);

$paths->option('mutable', 'false');

function path($key = '', $filepath = '')
{
    return pathconfig\PathConfig::instance()->get($key, $filepath);
}

pathconfig\PathConfig::alias('path');

$path = path('config', 'email.php');

pathconfig\PathConfig::instance()
    ->option('basepath', __DIR__ . '/../../')
    ->load('config/paths.php');