Skip to content

Releases: slimphp/Slim

Version 2.5.0

09 Dec 23:07
Compare
Choose a tag to compare

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

05 Apr 18:36
Compare
Choose a tag to compare
  • 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

16 Feb 18:21
Compare
Choose a tag to compare
  • 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

16 Feb 17:54
Compare
Choose a tag to compare
  • Let Slim use the $_SERVER["HTTP_CONTENT_TYPE"] value for use with the PHP built-in server.

Version 2.4.0

29 Nov 20:36
Compare
Choose a tag to compare

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

31 Oct 02:07
Compare
Choose a tag to compare

Fixes \Slim\Environment path parsing issue for Windows users.

Version 2.3.4

26 Oct 16:47
Compare
Choose a tag to compare

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

08 Oct 18:03
Compare
Choose a tag to compare

This is a maintenance release and remains backward-compatible with Slim 2.* applications.

  • Let \Slim\Flash implement Countable
  • Fix \Slim\Middleware\PrettyExceptions error when custom Log defined
  • Omit response body for HEAD requests
  • Add HHVM compatibility

Version 2.3.2

27 Sep 01:52
Compare
Choose a tag to compare

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

Version 2.3.1

20 Jul 18:41
Compare
Choose a tag to compare
  • Add \Slim\Slim::_isset and \Slim\Slim::__unset methods
  • Add CONTRIBUTING file
  • Add \Slim\Helper\Set::protect method to store Closure values that should not be invoked
  • Fix encrypted cookie expiration time during serialization into HTTP header
  • Fix Last-Modified and Expires header date format
  • Fix \Slim\View::setData so that it protects Closures used as template variables