项目作者: joseluisq

项目描述 :
A boilerplate for getting started with latest CodeIgniter using Composer.
高级语言:
项目地址: git://github.com/joseluisq/codeigniter-composer-boilerplate.git


codeigniter-composer-boilerplate

A boilerplate for getting started with latest CodeIgniter using Composer.

Getting started

Only follow these steps:

1) Install Composer.

2) Clone or download the CodeIgniter source code.

3) Edit the ./index.php root file and add the composer autoloader:

  1. // Composer autoload (add this line before CodeIgniter core)
  2. require_once __DIR__ . '/vendor/autoload.php';
  3. require_once BASEPATH.'core/CodeIgniter.php';

4) Create a composer.json file in the root. This file is for your third-party packages that you want to use.

  1. {
  2. "description": "My first application",
  3. "require": {
  4. "php": ">=5.5"
  5. }
  6. }

Testing the configuration

1) For example, install GImage package:

  1. composer require joseluisq/gimage

2) In your application/controllers/Welcome.php add these lines:

  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. use GImage\Image;
  4. class Welcome extends CI_Controller {
  5. public function index()
  6. {
  7. // This code will output a Github image in your browser.
  8. $url = 'https://assets-cdn.github.com/images/modules/logos_page/Octocat.png';
  9. $avatar = new Image();
  10. $avatar->load($url)->output();
  11. }
  12. }

3) Run your server and navigate.