Download the PHP package talesoft/tale-controller without Composer

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

Tale Controller

A Tale Framework Component

What is Tale Controller?

A middleware for talesoft/tale-app that allows easy instanciation and handling of controllers.

You can either use single, static controllers or use a dispatcher that automatically handles everything.

Installation

Install via Composer

Usage

Single usage

A single controller can make up a whole website. This is really useful for small websites with 5-10 sub-pages. No configuration needed.

Using the Dispatcher

When apps get larger, you want to split functionality into single modules. With the Dispatcher you can control an automatic controller dispatching mechanism.

Imagine the following controller structure:

This is a common case that the dispatcher can handle with a low configuration profile.

Now you could call the editAction of the Admin\IndexController by requesting index.php?module=admin&action=edit

Notice that all values are completely optional.

ServerRequestInterface attributes

The following attributes are handled by the dispatcher:

module (Default: null)

Tells the dispatcher which namespace to find controllers in. The controller.nameSpace option will be prepended in any case.

controller (Default: index)

Tells the dispatcher, which controller to load. my-blog will be parsed to MyBlogController

The following attributes are handled by the controllers:

action (Default: index)

Tells the controller which action to call. edit-user will be parsed to editUserAction

If there's an getEditUserAction-method, that one will only listen to GET-requests The same goes for POST-requests with postEditUserAction. Not prefixing will handle all request methods.

id (Default: null)

Specifies the first parameter given to the action. Allowed values are numerical values and canonical strings (some-user-name)

format (Default: html)

Specifies the format the result should appear in. This mostly equals the file extension of the called URI (/some-file.xml will yield format xml)

This format is to be used by some kind of output formatter/renderer.

Handle 404-errors

What if there's no fitting controller/it doesn't extend the correct class/the input is malformed etc.

That's all checked by tale-controller. Upon any kind of failure, control will be passed on to the next middleware.

Handling 404 is as simple as adding an "end"-middleware that results in said 404-error

Shorten things up

This module is specially designed to work with the Tale\Router. You can use it stand-alone, but it will require extra-work (but is still really cool!)

Here's an example of how it could look like by installing talesoft/tale-router via composer

env.json

Configuration options

All configuration options.

Using multiple dispatchers

Using multiple dispatchers is as easy as extending the dispatcher. You can set an option namespace to load different configuration values.


All versions of tale-controller with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
psr/http-message Version ~1.0
talesoft/tale-app Version ~0.1
talesoft/tale-http-runtime Version ~0.1
talesoft/tale-inflector Version ~0.1
talesoft/tale-loader Version ~0.1
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 talesoft/tale-controller contains the following files

Loading the files please wait ....