Download the PHP package spiffy/spiffy-config without Composer
On this page you can find all versions of the php package spiffy/spiffy-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spiffy/spiffy-config
More information about spiffy/spiffy-config
Files in spiffy/spiffy-config
Package spiffy-config
Short Description ZF2 module that provides route annotations directly in controllers.
License BSD-3-Clause
Homepage http://www.github.com/spiffyjr/spiffy-config.git
Informations about the package spiffy-config
SpiffyConfig Module
SpiffyConfig is a module designed to speed up configuration.
Installation
Installation of SpiffyConfig uses composer. For composer documentation, please refer to getcomposer.org.
Then add SpiffyConfig
to your config/application.config.php
Installation without composer is not officially supported, and requires you to install and autoload
the dependencies specified in the composer.json
.
Finally, copy config/spiffyconfig.global.php.dist
to autoload/spiffyconfig.global.php
directory. This will setup
the Application module out of the box.
Resolvers
Resolvers pass information to builders so that the builders know what to work on.
- File: resolves files using Symfony's file finder.
Builders
Builders take information from the resolvers and build configurations based on that information.
- RouteBuilder: reads route annotations and builds configuration via events.
- ServiceBuilder: reads service annotations and builds configuration via events.
- TemplateBuilder: takes files from the file resolver and builds a template_map from them.
Supported Annotations
Below is a list of currently supported annotations. This list will be updated as more annotations are supported. In order to use the annotations you must import them first. Do this by putting the following at the top of your code,
This will let you use SpiffyConfig's annotations using @Config
in your docblock.
Service
Service annotations are found in the SpiffyConfig\Annotation\Service
namespace and handle setting up invokables and
factories on various service managers.
Properties:
-
key: the key to use when defining the configuration (default: service_manager). You can use a pipe "|" to nest the key in the configuration array, e.g., my|nested would set the services as:
- shared: set the service as shared or not (default: null)
- type: this is set by using the
SpiffyConfig\Annotation\Service\Factory
orSpiffyConfig\Annotation\Service\Invokable
annotation (default: factories/invokables repsectively) - name: the name to use for the service. If no name is specified the FQCN is used.
There are several annotations that extend the service annotations and predefine the key
property to save you the
extra step. Each of these have a Factory and Invokable annotation available.
Service Annotations:
SpiffyConfig\Annotation\Controller
: key set tocontrollers
SpiffyConfig\Annotation\Form
: key set toform_elements
SpiffyConfig\Annotation\Hydrator
: key set tohydrators
SpiffyConfig\Annotation\RouteManager
: key set toroute_manager
Route
Route annotations handle setting up routes directly in your controllers. They can be set at the class level or the method level. If set on the class level you must specify the action that the route pertains to. If set directly on the method then the action is set for you.
Currently, the following routes are available:
- Generic: used to setup any type of route you want. Nothing is managed directly.
- Literal: setup literal routes
- Regex: setup regex routes.
- Segment: setup segment routes.
Example:
Controller
Controllers have an additional RouteParent
annotation other than the service annotations listed above. This
annotation let's you set the parent for all actions in the current controller.
Options
All options are available in the SpiffyConfig\ModuleOptions
class with detailed descriptions.
CLI Tool
A CLI tool is provided to build and clear the cache. Run your public/index.php
from a console to see the relevent
information.
Automatic Route Names
It's recommended that you specify a name for all routes e.g., @Route\Literal("/", name="home")
. Failure to do so will
cause an automated route name to be generated based on a canonicalized version of the controller and action name.
For example, if you have a controller registered with the ControllerManager as My\Controller
and are a adding a route
to the indexAction
the auto-generated route name would be my_controller_index
.
Zend Developer Tools
A toolbar button is provided if you are using ZendDeveloperTools which lists various SpiffyConfig information and allows you fast access to refreshing the page with the key set.
All versions of spiffy-config with dependencies
doctrine/common Version ~2.2
symfony/finder Version ~2.2
zendframework/zend-cache Version ~2.2
zendframework/zend-code Version ~2.2
zendframework/zend-console Version ~2.2
zendframework/zend-log Version ~2.2
zendframework/zend-mvc Version ~2.2
zendframework/zend-serializer Version ~2.2
zendframework/zend-version Version ~2.2