PHPackages                             mpmont/ci-toolkit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mpmont/ci-toolkit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mpmont/ci-toolkit
=================

View autoloading, notification library and helpers

182386[1 issues](https://github.com/mpmont/codeigniter-4-toolkit/issues)PHP

Since Mar 31Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/mpmont/codeigniter-4-toolkit)[ Packagist](https://packagist.org/packages/mpmont/ci-toolkit)[ RSS](/packages/mpmont-ci-toolkit/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

codeigniter 4 Toolkit
=====================

[](#codeigniter-4-toolkit)

A set of libraries and helpers for codeigniter 4

Composer Install
----------------

[](#composer-install)

This way you should run the following command in your terminal.

```
composer require mpmont/ci-toolkit dev-master

```

Or add the following to your composer.json file.

```
{
    "require": {
        "mpmont/ci-toolkit": "dev-master"
    }
}

```

Dependencies
------------

[](#dependencies)

- elephpant/breadcrumb [Breacrumb Library](https://github.com/sergiodanilojr/breadcrumb)
- almasaeed2010/adminlte [Admin LTE template](https://github.com/ColorlibHQ/AdminLTE)

Suggested dependencies
----------------------

[](#suggested-dependencies)

### IonAuth

[](#ionauth)

As an authentication system I suggest using Ion Auth. To add that to your project just run the following commands on your project.

```
$ composer config minimum-stability dev
$ composer config repositories.ionAuth vcs git@github.com:benedmunds/CodeIgniter-Ion-Auth.git
$ composer require benedmunds/CodeIgniter-Ion-Auth:4.x-dev

```

Documentation for Ion Auth can be found [Here](https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/4/USERGUIDE.md).

### pwrsrg/codeigniter4-cart-module

[](#pwrsrgcodeigniter4-cart-module)

In case you're building a store and need a cart module just add this to your composer.json and you're good to go.

```
$ composer require pwrsrg/codeigniter4-cart-module

```

Documentation can be found [Here](https://github.com/pwrsrg/codeigniter4-cart-module).

Base Controller
---------------

[](#base-controller)

codeigniter-base-controller is an extended `BaseController` class to use in your CodeIgniter applications. Any controllers that inherit from `BaseController` get intelligent view autoloading and layout support. It's strongly driven by the ideals of convention over configuration, favouring simplicity and consistency over configuration and complexity.

#### Usage

[](#usage)

If you install the package via composer then controllers should use a different namespace. In that case your controllers that extend to base Controller should extend to \\Toolkit\\Controllers\\BaseController, like so:

```

Footer

```

If you wish to disable the layout entirely and only display the view - a technique especially useful for AJAX requests - you can set `$this->layout` to `FALSE`.

```
$this->layout = FALSE;

```

Like with `$this->view`, `$this->layout` can also be used to specify an unconventional layout file:

```
$this->layout = 'layouts/mobile.php';

```

Any variables set in `$this->data` will be passed through to both the view and the layout files.

#### View structure

[](#view-structure)

Your views should be created to support the built in functionality of layouts that comes with codeigniter 4

```

    Hello World from the home/index view!

```

As for your layouts, those should have a render section called yield.

```

    My Layout

    This is my layout content

```

To actually be able to rendere a view directly without the layout we need an empty layout doing the render. For that there's a nolayout.php file included in your Views/layouts folder that only does the view render.

```

```

The complete folder structure is now included in the project.

### Loading Helpers in your controllers

[](#loading-helpers-in-your-controllers)

If you want to load helpers in your controllers in a global scope and not inside a function all your have to do is declare the helpers property as array with all your helpers, like so:

```
