Download the PHP package krak/mw-codeigniter without Composer

On this page you can find all versions of the php package krak/mw-codeigniter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mw-codeigniter

Mw Http CodeIgniter Integration

You can integrate the Mw Http framework with CI by embedding an Mw app inside of the CI framework.

The idea for this integration came from a legacy site I've managed before where we couldn't remove the old CI framework, but we needed to add new features that the Mw Http Framework could solve. So, this allows a nice bridge from an older system to a new one.

Installation

Install with composer at krak/mw-codeigniter

Usage

To have an app that you want to embed inside of the CI framework, you'll need to do a few things.

  1. Create a controller to handle the Mw Routes named like `application/controllers/mw.php`
  2. Create your mw app inside of the controller method.
<?php

use Krak\Mw\Http;

class Mw extends CI_Controller
{
    public function index() {
        $app = new Http\App();
        $app->with(Http\Package\std());
        $app->with(Http\Package\codeIgniter($this));

        $app->get('/a', function() {
            return '/a';
        });
        $app->get('/b', function() {
            return '/b';
        });
        $app->get('/exception', function() {
            throw new \InvalidArgumentException('Whoa!!!!');
        });

        $app->serve();
    }
}
  1. Register the default route to point to your mw/index action. All undefined routes will lead to it now.
<?php

$route['404_override'] = 'mw';

Make sure to add the CodeIgniter package last or at least later on in the packages.

API

These are all relative to the Krak\Mw\Http\Package namespace.

codeIgniter($ci, array $config = [])

returns a configured instance of CodeIgniter\CodeIgniterPackage. $ci must be an instance of the Codeigniter controller. $config is an array that allows the following configuration options:

show_stack_trace Forwarded to `ciExceptionHandler`

CodeIgniter\\ciExceptionHandler($show_stack_trace = true)

An exception handler that will use the CI `show_error` global func to display the exception. $show_stack_trace determines whether or not to display the stack trace of the exception along with the exception message.

CodeIgniter\\ciNotFoundHandler()

Simply uses the show_404 method from the CI framework to display a page not found.

CodeIgniter\\ciViewMarshalResponse($ci)

Allows actions to return two-tuples of [string, array] which represent the view path and the data to load into the view. This internally uses the $this->load->view method in the CI framework.

CodeIgniter\\CodeIgniterServiceProvider

The service provider defines the following services:

codeigniter.server This is a `Krak\Mw\Http\Server` which serves from inside of the CI framework. server Replaces the `server` parameter with the `codeigniter.server` instance.

Required Parameters

codeigniter.ci An isntance of CI. This value is automatically filled if you are using the CodeIgniterPackage interface; however, it will need to be set if you are using the service provider on its own.


All versions of mw-codeigniter with dependencies

PHP Build Version
Package Version
Requires krak/mw-http Version ^0.2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package krak/mw-codeigniter contains the following files

Loading the files please wait ...