Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek Van der Herten:
The Laracon Australia 2018 videos have been released
Nov 19, 2018 @ 10:08:37

As Freek Van der Herten mentions in his latest post, the videos for the sessions at this year's Laracon AU conference (their first year) have been posted to YouTube.

This year Laracon AU was held for the very first time. According to what I read on Twitter Michael Dyrynda did an awesome job organising it.

The organisation was so kind to record all talks. They are now available on YouTube. You'll find all talks in this playlist.

Sessions from their inaugural event included:

...and many more. Check out the full playlist for all of the great sessions including a keynote from Taylor Otwell introducing the Laravel Telescope introspection tool.

tagged: laraconau18 conference session video youtube release

Link: https://murze.be/the-laracon-australia-2018-videos-have-been-released

TutsPlus.com:
How to Use Sessions and Session Variables in PHP
Oct 04, 2018 @ 11:43:35

If you're new to PHP and are still learning the ropes, one thing that could be confusing is how the language handles sessions and the data they contain. In this new tutorial from the TutsPlus.com site, they introduce you to the basics of using sessions and the variables they contain to get you up to speed.

Session handling is a key concept in PHP that enables user information to be persisted across all the pages of a website or app. In this post, you'll learn the basics of session handling in PHP.

We'll start with an explanation of how sessions work and how they are related to cookies. Then we'll look at a few code snippets that demonstrate how to work with sessions. You'll learn how to create and destroy sessions, and how to change session variables.

The post starts with a general overview of what a session is and how the information flows back and forth from the user to the server. To illustrate, they provide an example of a simple login process, complete with flow diagram. The tutorial then shows how to:

  • start a new session
  • get the session ID
  • automatically start a session
  • destroying a session

It then covers the use of session variables: setting them, removing them and altering their contents.

tagged: session handling tutorial introduction start destroy variable

Link: https://code.tutsplus.com/tutorials/how-to-use-sessions-and-session-variables-in-php--cms-31839

Dieter Stinglhamber:
Join the light side, we have no cookies.
Jun 29, 2018 @ 11:44:27

Dieter Stinglhamber has a new tutorial posted to his site showing you how to build a Laravel application that doesn't use cookies...well, any cookies that could be used for tracking.

Since May 25th you have been harassed by "We have updated our privacy policy" emails but also websites started to great you with "Please, let us and our 256 partners track you".

In response to these abusive practices, some developers have decided to follow a better path, removing every cookie that is not needed. For example, my website doesn't have a single cookie, Spatie new website won't have any either. [...] I encourage every developer to do the same and if you are using Laravel, here's how you can (very) easily get rid of the default cookies set by the framework.

He talks about the two cookies that are used by default in Laravel applications: the CSRF token and the session ID. He shares ways to remove each of these cookies (if you're not using them) and, for a final "trick", removing other cookie-related middleware from the "web" group that interact with cookies.

tagged: cookies laravel remove tutorial csrf session middleware

Link: https://dieterstinglhamber.me/join-the-light-side-we-have-no-cookies

SitePoint PHP Blog:
How to Fix Magento Login Issues with Cookies and Sessions
May 21, 2018 @ 11:30:01

On the SitePoint PHP blog there's a new tutorial posted showing how to fix Magento login issue with cookies and sessions. This issue can cause a redirect loop but can be fixed.

In this article are looking at how Magento cookies can create issues with the login functionality of both the customer-facing front-end and admin back-end, the reason it occurs and how it should be resolved.

This is also known as the looping issue, as the screen redirects itself to the same screen, even though the username and password is correct.

The post starts with some basic definitions of "cookie" and "session" and gets into more detail on how Magento stores sessions and the places it can store them. The tutorial then covers each of the cookies used and three reasons the login issues might be happening:

  • Cookie domain does not match server domain
  • Multiple subdomains used and Magento’s cookie configuration is incorrect
  • Double front-end cookies causing intermittent login issues

For each several solutions are included with any code or SQL changes that need to happen to correct it.

tagged: magento tutorial fix login issue cookie session

Link: https://www.sitepoint.com/fix-magento-login-issues-cookies-sessions/

Matthias Noback:
Context passing
Apr 24, 2018 @ 10:20:26

In a new post to his site Matthias Noback shares some of his recent experience working with a multi-tenant application and the current "contexts" that exist during the user's session. In the most he makes some suggestions about how to generate this context on each request without having to resort to a "data clumping" approach.

In the beginning we start out with a framework that has some authentication functionality built-in. We can get the "current user" from the session, or from some other session-based object. We'll also need the "current company" (or the "current organization") of which the current user is a member.

In the web controller, we take this information out of the session (which we can possibly reach through the "request" object passed to the controller action as an argument). Then we start doing the work; making queries, making changes, sending mails, etc. All on behalf of the current user and the current organization. [...] Soon this starts to feel like a code smell known as a Data Clump: the same data hanging around together.

He offers a few different steps to follow to make sure you're correctly implementing this functionality and not violating the SRP (Single Responsibility Principle):

  • Injecting the session
  • The Context class
  • Passing contextual values on a need-to-know basis
  • Fetching more data when needed

For each item on the list there's a paragraph or two explaining the changes and functionality with code examples included where necessary for illustration.

tagged: context data request tutorial inject session

Link: https://matthiasnoback.nl/2018/04/context-passing/

Community News:
Videos of PHP Srbija 2017 have been released
Aug 10, 2017 @ 10:58:37

As Freek Van der Herten mentions on his site, the videos from this year's PHP Srbija conference (2017) have been released in a YouTube playlist.

Presentations for this year's event included:

You can check out the full list of sessions and videos in this YouTube playlist.

tagged: video release conference phpsrbija17 session

Link: https://www.youtube.com/playlist?list=PLfGr5rAHwhIJtdueIX5-9aEE7K94TNTqC

Community News:
PHP UK 2017 Videos Published
Apr 18, 2017 @ 09:12:59

As Freek Van der Herten has mentioned in this post on his site the videos for all of the sessions at this year's PHP UK Conference have been released over on YouTube.

Sessions at this year's event included:

...and many more. Be sure to check out the full playlist with 34 videos for lots of great speakers covering lots of great topics.

tagged: phpuk17 conference video recording session release youtube

Link: https://www.youtube.com/playlist?list=PL_aPVo2HeGF-_djRi_UVWWLdkVpYQFnFm

Michelangelo van Dam:
Sessions in PHP 7.1 and Redis
Dec 19, 2016 @ 12:09:17

Michelangelo van Dam has a new post to his site looking at using Redis for PHP sessions storage and changes related to the use of PHP 7.1.

In case you have missed it, PHP 7.1.0 has been released recently. Now you can’t wait to upgrade your servers to the latest and greatest PHP version ever. But hold that thought a second…

With PHP 7 lots of things have changed underneath the hood. But these changed features can also put unexpected challenges on your path. [...] One of these challenges that we faced was getting PHP 7.1 to play nice storing sessions in our Redis storage. In order to store sessions in Redis, we needed to install the Redis PHP extension that not only provides PHP functions for Redis, but also installs the PHP session handler for Redis.

When he installed the extension, the latest version (redis-3.1.0), he was given an error message about a failure to read the session data. He shares a bit of code he used to try to debug and diagnose the problem (and a Docker environment) that still resulted in the error. Ultimately they narrowed it down and discovered that it was the Redis extensions causing the problems. Downgrading it from 3.1.0 to 3.0.0 solved the issue right away.

tagged: session redis php71 extension tutorial troubleshoot error connection

Link: http://www.dragonbe.com/2016/12/sessions-in-php-71-and-redis.html

Anna Filina:
Re: When it comes to submitting talks, how many is too many?
Sep 14, 2016 @ 11:12:35

For those out there that are speakers (or are wanting to try their hand at speaking) at a technology conference, Anna Filina has shared her own thoughts about how many talks to submit to a single conference...and what might be too many.

I read this interesting post by Cal Evans about submitting conference proposals. He makes some very valid points, but I’d like to add my own experience as an organizer, so that when you submit, you have multiple perspectives.

She responds to Cal's comments about filtering talks based on topics the conference has mentioned, submitting a max of four talks and submitting the best idea first. Anna also shares some of her own recommendations as an organizer from the Confoo conference(s).

I know how hard it is to go through so many talks. At ConFoo, we receive close to 1000 proposals. [...] I don’t mean to tell other conferences what to do. However, speakers should always bear in mind that conferences operate differently. Perhaps organizers can create a comprehensive guideline specific to their event.
tagged: submit talk session conference toomany opinion organizer confoo

Link: http://afilina.com/re-how-many-is-too-many/

Laravel News:
Controller Construct Session Changes in Laravel 5.3
Aug 30, 2016 @ 10:45:13

On the Laravel News site there's a post detailing some of the updates made to session and controller handling in v5.3 of the framework. It mostly revolves around how the middleware handling changed on each request from v5.2.

Back in laravel 5.2, a developer was able to interact with the session directly in a controller constructor. However, this has changed in laravel 5.3.

The difference between how the 5.3 & 5.2 handle an incoming request is that in 5.2 the request goes through 3 pipelines: global, route and controller [...] In 5.3 the request goes through only 2 Pipelines: global and route/controller (in one pipeline).

The post includes a quote from Taylor Otwell (creator and lead developer of the framework) about why this change was made. Then it shows an alternative to directly accessing this session information in your controllers: a Closure-based middleware in the constructor to execute your checks.

tagged: laravel controller session update access middleware change v53

Link: https://laravel-news.com/2016/08/controller-construct-session-changes-in-laravel-5-3/