Skip to content
This repository has been archived by the owner on Jul 26, 2019. It is now read-only.

dbrkv/caramel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caramel

caramel

Caramel is codeigniter package. Delight for your web application.

Caramel mixed with Illuminate Database library, Twig template engine and Sentry authorization and authentication package

Install

Install Codeigniter framework firstly. You can just simply download .zip package from Codeigniter website or via composer:

composer create-project bcit-ci/CodeIgniter

Once Codeigniter installed,

in application/config/config.php set Composer autoloader path:

$config['composer_autoload'] = FCPATH . 'vendor/autoload.php';

In composer.json file and add psr-4 autoload for models:

  "autoload": {
    "psr-4": {
      "App\\Models\\": "application/models/"
    }
  },

then run composer require command:

composer require namesmile/caramel

Usage

Controller

Caramel shipped with abstract Caramel_Controller. Caramel controller can use templates and auth library.

To enable templating for controller you need setup protected $templated to true. For auth acccess to controller, just change protected $guarded to true also.

use Smartcat\Caramel\Controllers\Caramel_Controller;

    /**
     * Use template
     * @var bool
     */
    protected $templated = true;

    /**
     * Use garde
     * @var bool
     */
    protected $guarded = true;

    /**
     * Controller constructor
     */
    public function __construct()
    {
        parent::__construct();

        /**
         * Check auth
         */
        if (! $this->garde->check()) {
            $this->template->set_flash('Auth consroller');
            redirect('/');
        }
    }

    /**
     * Index controller method
     *
     * @return CI_Output
     */
    public function index()
    {
        return $this->template->render('app');
    }

You can also use only garde or template independently.

About

Caramel is Codeigniter package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages