PHPackages                             bulton-fr/bfw-controller - 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. bulton-fr/bfw-controller

ActiveLibrary

bulton-fr/bfw-controller
========================

Controllers module for BFW

1.1.0(12y ago)1499[1 PRs](https://github.com/bfw-systems/controller/pulls)LGPL-3.0PHPPHP &gt;=5.3.0

Since Feb 7Pushed 6y ago3 watchersCompare

[ Source](https://github.com/bfw-systems/controller)[ Packagist](https://packagist.org/packages/bulton-fr/bfw-controller)[ Docs](https://github.com/bulton-fr/bfw-controller)[ RSS](/packages/bulton-fr-bfw-controller/feed)WikiDiscussions 3.0 Synced today

READMEChangelog (10)Dependencies (1)Versions (18)Used By (0)

bfw-controller
==============

[](#bfw-controller)

Module Controller pour BFW

[![Build Status](https://camo.githubusercontent.com/2617de985f3244b0974e5023f9ff1ed68d42992682f47c657f0604d8b8bed647/68747470733a2f2f7472617669732d63692e6f72672f62756c746f6e2d66722f6266772d636f6e74726f6c6c65722e7376673f6272616e63683d332e30)](https://travis-ci.org/bulton-fr/bfw-controller) [![Coverage Status](https://camo.githubusercontent.com/d60c61b52bc8de96c276d58bf0c420a0d0f7c83698967276808e146c150404e2/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f62756c746f6e2d66722f6266772d636f6e74726f6c6c65722f62616467652e706e673f6272616e63683d332e30)](https://coveralls.io/r/bulton-fr/bfw-controller?branch=3.0) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/abeb3423be8707a106dd4a65fef0e340de67c7a8c415de843f85baeb72adc498/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62756c746f6e2d66722f6266772d636f6e74726f6c6c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d332e30)](https://scrutinizer-ci.com/g/bulton-fr/bfw-controller/?branch=3.0) [![Latest Stable Version](https://camo.githubusercontent.com/bb4016b3ded2a72dc0e6c5c305b500484c164365198071d1536b8b8c2e7ed24d/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f6266772d636f6e74726f6c6c65722f762f737461626c652e737667)](https://packagist.org/packages/bulton-fr/bfw-controller) [![License](https://camo.githubusercontent.com/b814cc20b088c4eaff2a586718a507b2a2996108f7930c581d47bab47b298ba6/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f6266772d636f6e74726f6c6c65722f6c6963656e73652e737667)](https://packagist.org/packages/bulton-fr/bfw-controller)

---

**Install :**

You can use composer to get the module : `composer require bulton-fr/bfw-controller @stable`

And to install the module : `./vendor/bin/bfwInstallModules`

**Config :**

All config file for this module will be into `app/config/bfw-controller/`. There are one file to configure (manifest.json is for the module update system).

The file config.php

- `useClass` : Define if all controller will be classes (`true`) or procedural file (`false`).

**Use it :**

Create your controller files into the directory `/src/controllers`.

For an object controller, you can extends from the class `\BfwController\Controller`. This class adding properties `$app` and `$request` who are a direct access to the instance of the classes `\BFW\Application` and `\BFW\Request`. You can use the namespace `\Controller`, it's added by the framework and corresponding to the directory `/src/controllers`.

For a procedural controller, the file will be included into a closure who is into the method `\BfwController\BfwController::runProcedural()`. So you will have a direct access to `$this` of the class, and you will have variables `$routerLinker` and `$controllerFile` into the scope.

**Example :**

Extract from the [BFW wiki](https://bfw.bulton.fr/wiki/v3.0/fr/scripts-d-exemple#web), an exemple with an object controller.

```
