This video will be available to
subscribers on Tue, Jun 10, 2025.
You must be a subscriber to view this video.
Jun 10, 2025
25m:6s

Sessions / Redirects / Flash Messages

Classification
Software Engineering | Languages | PHP
Keywords
oop | php

About This Episode:

Now that users can submit reviews, let’s give them feedback! In this video, we bring in sessions, redirects, and flash messaging to guide the user experience after form submissions. ✨

Here’s what gets built in version v18-redirects-with-flash:


- Create a Session class as a singleton, with a handy global session() helper 🔐
- Initialize the session at app start and build a clean API like:
- session()->error('Missing required parameters.')->redirect('/');
- Implement error() and redirect() methods for smooth flow and messaging
- Fix the issue of persistent flash messages by introducing delete_transient_data() to clear session data after one request cycle
- Use Alpine.js to display flash messages dynamically with a snappy user experience ⚡
- Create a reusable _flash.view.php layout file for flash UI 💡
- Hook flash messages into the review flow by updating all dd('TODO') redirects in the PhotoController
- Bonus: Add current_route support in the Router to improve context-awareness in views 🧭


With sessions and flash messages in place, your app now speaks back to the user—clear, friendly, and fast. 🚀
Bob Cravens

Bob Cravens

Your Instructor
more »
Owner
TekFoundry
Wisconsin
United States
Short Bio:
Bob Cravens is a seasoned technology leader, software architect, and educator with a passion for empowering others through practical, real-world knowledge. As the founder of TekFoundry, Bob has dedicated his career to designing and delivering innovative software solutions that combine cutting-edge technology with elegant simplicity.

At TekCasts, Bob leverages over two decades of experience in software engineering, application architecture, and team leadership to create engaging, high-impact courses for developers and technology professionals. His instructional style is rooted in practical application, offering insights drawn from his extensive background in industries like medical devices and global technology consulting.

Bob’s expertise spans a variety of technologies and methodologies, including PHP/Laravel, FastAPI, and DevOps, as well as architecture best practices and team dynamics. Whether teaching foundational concepts or advanced strategies, he’s passionate about helping others turn complex challenges into streamlined solutions.

When not crafting elegant code or inspiring the next generation of tech innovators, Bob enjoys exploring the intersection of technology, business strategy, and creative problem-solving.