Upgrade Guide
Upgrading to v4.3 from v4.2
There is nothing that requires upgrading between these versions.
Upgrading to v4.2 from v4.1
We aim to document all the changes that could impact your theme, and there may only be a portion that are applicable to your theme.
Extending controllers
Create app/Http/Controllers/Controller.php
with the following contents:
In all of your controllers, extend from this new base controller. For example:
Here are the list of controllers that come out of the box:
404.php
archive.php
author.php
index.php
page.php
search.php
single.php
Upgrading to v4.1 from v4.0
There is nothing that requires upgrading between these versions.
Upgrading to v4 from v3
We aim to document all the changes that could impact your theme, and there may only be a portion that are applicable to your theme.
Composer
Update lumberjack-core
to version 4.
PHP Version
Likelihood Of Impact: High
Support for PHP 7.0 has been dropped, ensure you're running at least PHP 7.1.
Service Providers
Likelihood Of Impact: Critical
Add the following providers to config/app.php
:
The query builder is now part of the core, rather than an external package. If you were using the package, you will need to remove its service provider from your list of providers
above.
Exception Handler
Likelihood Of Impact: Critical
The type hint on the render()
function has changed to the PSR interface from the concrete Zend implementation.
Make the following change in app/Exceptions/Handler.php
:
From:
To:
No changes should be required to your application logic as Zend subclasses will already comply with the new interface.
Container
Likelihood Of Impact: Medium
The bind()
method on the Application
container is no longer a singleton by default when the value (2nd param) is not a primitive or object instance.
When binding a concrete implementation to an interface, using singletons by default can create unexpected side affects as state is maintained across instances.
A new singleton()
method has been provided to enable the previous behaviour. This enables the app developer to be more intentional about the behaviour they desire.
For example:
ServerRequest
class (optional)
ServerRequest
class (optional)Likelihood Of Impact: Optional, but recommended
If you're injecting an instance of the Diactoros ServerRequest
class into a Controller, you can now switch this out for the following class if you want to benefit from some of the new helper functions:
For example:
If you have enabled global helpers, you can use access the current ServerRequest
instance using the request()
helper instead of using dependency injection. For example:
Here's a quick overview of what the new ServerRequest
object can do. If you are using global helpers, you can replace $request
with request()
instead in the examples below:
Query Parameters
Input
View Models
Likelihood Of Impact: Medium
This is a previously undocumented feature. If you are using ViewModels, this is a major change to how they work. However, if you are not using ViewModels you do not need to do anything.
View Models are simple classes that allow you to transform data that would otherwise be defined in your controller. This allows for better encapsulation of code and allows your code to be re-used across your controllers (and even across themes).
Upgrading existing ViewModels
The ViewModel
base class no longer extends from stdClass
and so can no longer have arbitrary properties set on it.
We'd suggest upgrading your existing ViewModels to either use public methods or public properties. If your project has a large number of ViewModel's, the simplest change is to specifically name all properties in the class.
For example:
To:
Binding of the Exception Handler
Likelihood Of Impact: Very low
In bootstrap/app.php
you should change how the exception handler is bound to Rareloop\Lumberjack\Exceptions\HandlerInterface
.
From:
To:
Helpers::app()
helper
Helpers::app()
helperLikelihood Of Impact: Very low
Helpers::app()
(and the app()
global counterpart) no longer use the make()
method of the Application instance and now rely on get()
. This provides much more consistent behaviour with other uses of the Container. If you still want to use the helpers to get make()
behaviour you can change your code.
From:
To:
Router
class namespace
Router
class namespaceLikelihood Of Impact: Very low
If you resolve an instance of the Router
class from the container, you'll need to change the class reference.
If you're just using the Router Facade, you do not need to change anything.
From:
To:
PSR-15 Middleware
Likelihood Of Impact: Very low
The http-interop/http-server-middleware
package has been deprecated in favour of the now official PSR-15 interfaces found in psr/http-server-middleware
.
Make sure any middleware used now complies with the Psr\Http\Server\MiddlewareInterface
interface.
Last updated