In Silex-based projects I always define my routes with a trailing /. When defining a route with a trailing slash, the router will respond to both the route without and with slash: $app->get(‘/hello’, …); will respond to http://localhost/hello but not to http://localhost/hello/ $app->get(‘/hello/’, …); will respond to http://localhost/hello and to http://localhost/hello/ Unfortunately this only works […]
use Knp\Provider\ConsoleServiceProvider; $app->register(new ConsoleServiceProvider(), array( ‘console.name’ => ‘ConsoleApp’, ‘console.version’ => ‘1.0.0’, ‘console.project_directory’ => __DIR__ . ‘/..’ )); Good writeup and code by Ken, a former student of mine. Using ConsoleServiceProvider with Silex → Want to start developing with Silex? Then check out my freely available course materials on the subject.
For the course Webscripting2 I’m lecturing at ikdoeict.be/KaHo Sint-Lieven, we’re working with Silex. Next to the slidedeck explaining Silex, all examples are freely available on GitHub (links at the bottom of this post) The collection of examples start with the very basics of Silex and introduce more routing options and services as they continue. Basic:The […]
The past few days I’ve been playing around with Silex, a micro PHP Framework. At a certain point I got stuck in the process when using a custom controller: the darn class just wouldn’t load and the (otherwise excellent) documentation on the Silex site has not mention on how to load it. Most of the […]