PHP code example of yidas / codeigniter-psr4-autoload

1. Go to this page and download the library: Download yidas/codeigniter-psr4-autoload 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/ */

    

yidas / codeigniter-psr4-autoload example snippets


new \app\libraries\MemberService;

\app\services\Process::run();

class Blog_model extends app\models\BaseModel {}
class Blog extends app\components\BaseController {}
class Car implements app\contracts\CarInterface {}

$config['composer_autoload'] = TRUE;


namespace app\helpers;

class ArrayHelper
{
    public static function indexBy($input) {}
}


use app\helpers\ArrayHelper;
...
ArrayHelper::indexBy($input);
\app\helpers\ArrayHelper::indexBy($input);


namespace app\models;

class BaseModel extends \CI_Model {}



class My_model extends app\models\BaseModel {}


namespace app\interfaces;

interface CarInterface {}


namespace app\libraries;

class Car implements \app\interfaces\CarInterface {}


namespace app\components;

trait LogTrait {}

class Blog extends CI_Controller
{
    use \app\components\LogTrait;
}


namespace app\components;

abstract class BaseController extends \CI_Controller {}

class Blog extends app\components\BaseController {}