PHPackages                             adelowo/cfar - 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. [Framework](/categories/framework)
4. /
5. adelowo/cfar

ActiveLibrary[Framework](/categories/framework)

adelowo/cfar
============

Using Controllers with Aura.Router

1.2(9y ago)1721MITPHPPHP ~5.5|~7.0

Since Jan 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/adelowo/cfar)[ Packagist](https://packagist.org/packages/adelowo/cfar)[ Docs](https://github.com/adelowo/cfar)[ RSS](/packages/adelowo-cfar/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (9)Used By (0)

CFAR - Controller for Aura Router
=================================

[](#cfar---controller-for-aura-router)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b2a74646945c7fa150e3f7242bbc8f90fcd3b89ca963f0ba7ec2d95f9e41d046/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164656c6f776f2f636661722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adelowo/cfar)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/27410fb57119532a55108124b6b00d1e4f6be1e0034b5b74e1f3611a2e8d6439/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6164656c6f776f2f636661722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/adelowo/cfar)[![Scrutinizer Coverage](https://camo.githubusercontent.com/9843595c062d2740d7c8c497dd93e1854c56b601294a3dcd31d4df65e1ceba64/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6164656c6f776f2f636661722e7376673f6d61784167653d32353932303030267374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/adelowo/cfar/?branch=master)[![Quality Score](https://camo.githubusercontent.com/d51f63868e1349bc4688239b41fe6835fbf36d31479b34baac8cb59b214d37d9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6164656c6f776f2f636661722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/adelowo/cfar)[![SensioLabsInsight](https://camo.githubusercontent.com/124d109488c2868fade040942b9831344c5789f44d559f3e00cc5f47fae4e94a/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f30396666333465652d666562332d343963302d616362632d3532373831313739646562392e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/09ff34ee-feb3-49c0-acbc-52781179deb9)[![Total Downloads](https://camo.githubusercontent.com/f0517317dfeb8fff7639b88e545069499a71d8cc91a66bcb2d84b49b4a1f5ca8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6164656c6f776f2f636661722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adelowo/cfar)

This library was written to enable users of Aura.Router make use of symfony/laravel "type" controllers.

#### Already using CFAR , Migrate to: [1.2](migration-to-1.2.md)

[](#already-using-cfar--migrate-to-12)

### Installation

[](#installation)

You are recommended to make use of the latest available PHP version, but CFAR should run on &gt;=5.5.

CFAR has a dependency, which is Aura.Router. &gt;=1.0 releases require Aura.Router 3.x while &lt;=0.2.1 requires Aura.Router 2.x .

Install CFAR via one of the following methods :

- [Composer](https://getcomposer.org) :

```
    composer require "adelowo/cfar" : "~1.0"
```

> If you are still using Aura.Router 2.x, please install 0.x

```
    composer require "adelowo/cfar" : "~0.2"
```

- Repo Cloning :

```
    git clone https://github.com/adelowo/cfar.git
```

- [Download a release](https://github.com/adelowo/cfar/releases)

> If downloading the library without composer or cloning directly from the repository, you'd have to write an autoloader yourself

### Usage

[](#usage)

Cfar doesn't require any special config - other than specifying the class that acts as your controller (namespaced) and method to invoke - you'd still write your routes as specified in Aura.Router's (3.x) doc.

Aura.Router 3 is a big improvement to the much loved router with it being broken into many parts such as a Mapper, Matcher, Route (that contains the matched route).

> Internally, Cfar uses PHP's Reflection Api.

> By default, Cfar would search and invoke a method called `indexAction`

Below is a little snippet that shows Aura.Router and Cfar ***fully integrated***, an `index.php` file and controllers for the routes would be written.

```
