Download the PHP package codermarcel/simple-controller without Composer

On this page you can find all versions of the php package codermarcel/simple-controller. 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 simple-controller

SimpleController

SimpleController is a convenient reflection based controller for the [php micro-framework silex] (http://silex.sensiolabs.org/) SimpleController makes it easy for you to use controllers in your silex applications and matches your controller methods to routes automatically

Installation

Run the following command:

Setup

Method - 1

Extending the SimpleController

Mount the route

Method - 2

Using a raw class

If you don't want to extend the SimpleController class, then you can use a raw class as well.

Mount the route

Note use the full namespace name for your controller class

Usage

HTTP methods

The method names should begin with the HTTP verb they respond to followed by the route name.
The following methods are available :

below are some examples

Organizing Controllers

When your application starts to define too many controllers, you might want to group them logically:

mount() prefixes all routes with the given prefix and merges them into the main Application. So, / will map to the main home page, /blog/ to the blog home page, and /forum/ to the forum home page.

For more information on Organizing Controllers, please take a look at the offical [silex documentation] (http://silex.sensiolabs.org/doc/organizing_controllers.html#organizing-controllers)

Example 1

Example 2

Route variables

You can define variable parts in a route like this:

Note default route values are currently not supported but might be added in a later version.

Request and Application injection

You can also ask for the current Request and Application objects like this:

Note silex does the injection based on the type hinting and not on the variable name!

Named routes

You can bind a route name to your routes by using the $bind parameter in your routes.

For more information on named route and the UrlGeneratorServiceProvider please take a look at the [offical silex documentation] (http://silex.sensiolabs.org/doc/providers/url_generator.html#urlgeneratorserviceprovider)

Middleware

Silex allows you to run code, that changes the default Silex behavior, at different stages during the handling of a request through middlewares:
[…]
Route middlewares are triggered when their associated route is matched.

For more information about middlewares, please take a look at the offical [silex documentation] (http://silex.sensiolabs.org/doc/middlewares.html#middlewares)

Note You can typehint the Request, Response or Application object and silex will inject them for you.

Credits

SimpleController was inspired by
https://gist.github.com/igorw/4524636
And http://laravel.com/docs/5.1/controllers#implicit-controllers


All versions of simple-controller with dependencies

PHP Build Version
Package Version
Requires silex/silex Version ~1.3
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 codermarcel/simple-controller contains the following files

Loading the files please wait ....