Download the PHP package davedevelopment/tinder without Composer
On this page you can find all versions of the php package davedevelopment/tinder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tinder
Tinder
:fire: :fire: With Silex and Tinder, your apps will be on fire :fire: :fire:
A few helpers for Silex, that help you move boundaries outside your controllers where possible. It's a little hard to explain why you might want that, but eventually I'd like to have an example application that can show some of the benefits.
At this stage, Tinder is completely backwards-compatible with
Silex, so you should be able to instantiate or extend Tinder\Application
,
rather than Silex\Application
and your existing functionality will still work.
Table Of Contents
- Controllers as Services
- Argument Injection
- Template Rendering
- Redirects
- Event Listeners as Services
- README Driven Development
- Contributing
- Copyright
Controllers as Services
UPDATE - This is now available as the ServiceControllerServiceProvider the Silex Core, Tinder enables it by default.
Argument Injection
Tinder extends the default controller resolver to allow injecting HTTP GET or POST vars directly as controller arguments.
Why? This means your controllers can be dependent on an arbitrary array of query vars or
parameters, rather than a Symfony\Component\HttpFoundation\Request
. Want to
share controller code between the CLI and Web interfaces?
Template Rendering
Tinder adds a simple route helper that allows you to return an array of context variables from your controllers and have them rendered by a twig template defined on the route. An optional second argument allows you to manipulate the returned data before being passed to the template, allowing for presenters or ViewModels and the like.
Why? Why should your controller be responsible for rendering a template?
Redirects
Redirecting to a URL after a successful action (e.g. POST/REDIRECT/GET) doesn't have to be the concern of your controller/use case/interactor, tinder provides a simple DSL to tell it to send a redirect response if the controller returns null.
If you're using the UrlGeneratorServiceProvider
, you send a string id and a
callable, which must return the params for the url generator. The callable can
use the same name and type hinting semantics as a regular controller.
Something similar can also be achieved if you're not using the generator, by having a callable generate the url.
Event Listeners as Services
Much like the controllers, Tinder includes a PimpleAwareEventDispatcher
,
allowing you to configure services as event listeners or subscribers, so that
they are lazy loaded.
Why? Performance. If you fully adopt the event dispatcher, your listeners are likely to be many, which in turn are likely to have many dependencies. This method saves loading them until they're actually needed.
Readme Driven Development
Most of this isn't implemented yet, but here's the kind of thing I'd like to get to, if it's even possible
Contributing
Get in touch before hacking on anything, I've no idea what I might be doing, the whole library may have changed since my last push :)
Copyright
Copyright (c) 2012 Dave Marshall. See LICENCE for further details