thanhtaivtt/codeigniter-app

The CodeIgniter framework customs version

3.0.0 2018-04-23 09:17 UTC

This package is auto-updated.

Last update: 2020-08-25 11:37:03 UTC


README

CodeIgniter Plus is a powerful version that combines Codeigniter, Taiscript, Laravel collection, Laravel Eloquent and Blade template.

Requires

  • php: >= 5.6.0

Instalation

  • Download this source and run the commandline:
$ composer install
  • Or run commandline:
$ composer create-project thanhtaivtt/codeigniter-app projectName

Usages

taiscript

Example:

// make controller
$ php taiscript make:controller HomeController

// make model 
$ php taiscript make:model User

// make helper
$ php taiscript make:helper HelperName

// make library
$ php taiscript make:library LibraryName

// make eloquent Model
$ php taiscript make:Eloquent EloquentName

// clear cache
$ php taiscript clear:cache

// Show list cmd
$ php taiscript help

Eloquent ORM

Example:

  • Eloquent Model
<?php

use \Illuminate\Database\Eloquent\Model as Eloquent;

class User extends Eloquent
{
    protected $table = 'users';

}
  • Controller
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class HomeController extends CI_Controller
{

	public function index()
	{
		$this->load->model('user');

		$users = User::where('votes', '>', 1)->get();

	}
}
  • Middleware:

Create middleware in application/middleware folder. With file name equal function name inside middleware.

Eg:

<?php
//application/middleware/Example.php

function Example()
{
    //something
}

// call in controller
// middleware('MiddelwareName')

Using The Blade Template

Example:

  • Controller
defined('BASEPATH') OR exit('No direct script access allowed');

class HomeController extends CI_Controller {

	public function index()
	{
		$this->load->model('user');

		$data = User::where('votes', '>', 1)->get();

		$this->view('ViewName',['data' =>$data ]);
	}
}

Input

  • In Controller:
// get
$this->get('name');

// post
$this->post('name')

Documentation