Releases: slimphp/Slim
Version 2.6.0
- Fixes object injection vulnerability in SessionCookie.php
- Added new HTTP status codes
- Added default HTTP request port for Google App Engine
- Improved URI parsing
- Miscellaneous improvements
You can review commits at https://github.com/slimphp/Slim/commits/master
Version 2.5.0
redirectTo
You can now use redirectTo
when you want to redirect to a named route. redirectTo
is a shortcut for redirect(urlfor(..))
$app->get('/', function () {})->name('home');
$app->get('/home', function () use ($app) {
$app->redirectTo('home');
});
Route::via() and Route::appendHttpMethods()
Allow passing array of methods to via()
and appendHttpMethods()
$app->get('/', function () {
echo "This route only available on GET and POST requests";
})->via(array('GET', 'POST'));
Other Changes
- Fix failed test because of hardcoded directory separator on Windows
- Add PHP 5.6 to Travis CI tests
- Added how to run Slim on Google App Engine/Cloud Platform to the README.markdown
Version 2.4.3
- Lazy-initialize callables in
\Slim\Route::setCallable()
- Fix
\Slim\Http\Util::parseCookie()
for cookie values that contain "=" - Improved debug stack trace output
- Allow default values for
\Slim\Http\Request::params()
- Fix
X-Forwarded-For
header detection - Require
phpunit
as Composer dev dependency - Improve controller method name detection in
\Slim\Route::setCallable()
- Re-merge commits from a mistakenly-deleted earlier branch
Version 2.4.2
- Add (string) cast in encodeSecureCookie call to
hash_hmac
- Routes can be case-insensitive based on a config setting.
- Try running unit tests on HHVM
Version 2.4.1
- Let Slim use the
$_SERVER["HTTP_CONTENT_TYPE"]
value for use with the PHP built-in server.
Version 2.4.0
Class controllers
You may now use a controller class instance as a callback for your Slim app routes.
$app->get('/hello/:name', '\Greeting:sayHello');
In this example, when the app receives a request for "/hello/Josh", it will instantiate class \Greeting
and pass the value "Josh" into its sayHello
method.
Note that we separate the class name and the class method with a single ":" colon. This is a unique syntax used by Slim to implement this functionality. Do not confuse this with the "::" syntax used for static method calls.
Request parameter defaults
When fetching request data with the \Slim\Http\Request
object's get()
, post()
, put()
, patch()
, or delete()
methods, you can define the default value you want if the requested data is not available. For example:
$app->get('/books', function () use ($app) {
$value = $app->request->get('genre', 'fiction');
});
In this example, we expect the HTTP request to have a URL query parameter genre
. If this query parameter does not exist, we will use "fiction" as the default value.
View Template Data
You may now pass data into a view template with \Slim\View::display()
and \Slim\View::fetch()
.
// Fetch a rendered template into a variable
$renderedTemplate = $app->view->fetch('my-template.php', ['foo' => 'bar']);
// Echo a rendered template to the output buffer
$app->view->display('my-template.php', ['foo' => 'bar']);
Other Changes
- Remove mcrypt dependency
- Add PHP 5.5 to Travis CI tests
- Improve typehinting with popular PHP IDEs
- Ensure application view template directory is defined on view construction
- Add HTTP 418 status code to
\Slim\Http\Response
Version 2.3.5
Fixes \Slim\Environment
path parsing issue for Windows users.
Version 2.3.4
Fix a regression with \Slim\Environment
path parsing. This regression affected developers relying on Apache Aliases or filesystem symlinks.
HipHop VM users must now explicitly define the SCRIPT_NAME
server variable in their HHVM configuration file, at least until HipHop VM sets this server variable correctly on its own.
Version 2.3.3
This is a maintenance release and remains backward-compatible with Slim 2.* applications.
- Let
\Slim\Flash
implementCountable
- Fix
\Slim\Middleware\PrettyExceptions
error when custom Log defined - Omit response body for HEAD requests
- Add HHVM compatibility
Version 2.3.2
This is a maintenance release with several bug fixes and improvements. All changes are backwards compatible with existing Slim 2.x applications.
- Remove encryption concerns from
\Slim\Middleware\SessionCookie
middleware - Fix HTTP method override detection via
X-HTTP-Method-Override
header - Fix padding removal in
\Slim\Http\Util::decrypt
- Prevent XEE attack vector in
\Slim\Middleware\ContentTypes::parseXml
- Fix
\Slim\Slim::urlFor
when used with escaped regular expression characters