CakePHP - The Road Ahead

64
The Road Ahead 3.4 and the path to 4.0

Transcript of CakePHP - The Road Ahead

The Road Ahead3.4 and the path to 4.0

Present FuturePast

Past

Past 2.x - 3.0.0

Past Upgrading was hard

Past Upgrading was brutal

Past 2.x is still active

Past What did we learn?

Past Difficult upgrades

Fragment the community

Past Stagnation

Big releases take time

Past

PresentPast

Present 3.2.x - 3.4.x

Present Working towards stronger typing

Splitting up modal methods

$email = new Email(); $email->to(‘[email protected]') ->from(‘[email protected]') ->template($template) ->helpers([‘Html’, ‘Emoji’]) ->send();

Combined Methods

$email = new Email(); $email->to(‘[email protected]') ->setFrom(‘[email protected]') ->setTemplate($template) ->setHelpers([‘Html’, ‘Emoji’]) ->send();

Combined Methods

Present PSR7

Adopting community standards

Present Immutability

Request & Response

// $response is unchanged here. $response->withHeader(‘X-yes’, ‘yes’);

// We need to overwrite $response $response = $response->withHeader(‘X-yes’, ‘yes’);

Immutability

Present Middleware

Your application as an onion

Present Layers of behavior

Small, focused, and composable

App

Routes

App

Assets

Routes

App

Exceptions

Assets

Routes

App

CORS

Exceptions

Assets

Routes

App

CORS

Exceptions

Assets

Routes

App

CORS

Exceptions

Assets

Routes

App

Request

CORS

Exceptions

Assets

Routes

App

Request

CORS

Exceptions

Assets

Routes

App

Request

Response

CORS

Exceptions

Assets

Routes

App

CORS

Exceptions

Assets

Routes

AppRequest

CORS

Exceptions

Assets

Routes

AppRequest

CORS

Exceptions

Assets

Routes

AppRequest

Response

PresentPast

Present FuturePast

Future 3.5

Future New Middleware

CSRF, Cookies, Authentication

use Cake\Http\Middleware\EncryptedCookiesMiddleware;

$middleware->add(new EncryptedCookiesMiddleware([ [‘remember_me’, ‘secrets’], Configure::read(‘Cookie.aesKey’) ]));

Cookies

use Cake\Http\Middleware\CsrfProtectionMiddleware;

$middleware->add(new CsrfProtectionMiddleware([ ‘expiry’ => 600, ‘httpOnly’ => true ]));

CSRF

Future Routable Middleware

// Register middleware, for use in routing scopes$routes ->registerMiddleware(‘auth’, new AuthenticationMiddleware(..)) ->registerMiddleware(‘cookies’, new EncryptedCookieMiddleware(..));

// Create a routing scope (as you do today)$routes->scope('/api', function ($routes) { // Enable middleware $routes->middleware('csrf', 'cors', 'auth'); $routes->connect('/ping', [‘controller’ => ‘Pings’]);});

Routable Middleware

Future 3.6 & 4.0

Future 3.6

Backwards compatible

Future Deprecation warnings

Runtime errors for deprecations

Future 4.0.0

Svelte CakePHP 3.x

Future PHP 7.1

No PHP5 support

Future Stricter Typing

Future Interface Updates

Future Deprecation Cleanup

All currently deprecated methods will be removed.

Future Developer Happiness

Better and earlier errors

Late 2017 | Early 2018

Future Long Term Support

Future 2.10

Long Term Support

Future 2.x bugfixes

1 year after 4.0.0

Future 2.x Security fixes

18 months after 4.0.0

Future 3.6

Long Term Support

Future 3.6 bugfixes

18 months after 4.0.0

Future 3.6 Security fixes

3 years after 4.0.0

Past

PresentPast

Present FuturePast

Thank YouGithub - markstory

Twitter - mark_story https://joind.in/talk/b71f6