This video will be available to
subscribers on Thu, Jun 19, 2025.
subscribers on Thu, Jun 19, 2025.
You must be a subscriber to view this video.
Jun 19, 2025
17m:11s
Fluent Validation
Classification
Software Engineering | Languages | PHP
Keywords
oop | php
About This Episode:
In this step, we introduced a flexible and expressive validation system.
🧱 Created the Framework/Validation class and added a validate() helper to globals.php.
✍️ The goal was to write intuitive validation logic like:
validate('rating')->integer()->min(0)->max(5)->required();
validate('name')->string()->max(100);
validate('comment')->string()->max(1000);
🧪 This fluent API allowed chaining validation rules for each input field, improving both readability and maintainability.
🔧 We fixed the num_stars constraint in the migration SQL to properly enforce the rating range.
🧹 Ran the migration and reseeded the database to apply the changes.
🕵️ Also refined the reviews logic to default the name to “Anonymous” when one isn’t provided.
This new validation infrastructure enhances data safety and gives us a consistent, clean way to validate user input throughout the application.
🧱 Created the Framework/Validation class and added a validate() helper to globals.php.
✍️ The goal was to write intuitive validation logic like:
validate('rating')->integer()->min(0)->max(5)->required();
validate('name')->string()->max(100);
validate('comment')->string()->max(1000);
🧪 This fluent API allowed chaining validation rules for each input field, improving both readability and maintainability.
🔧 We fixed the num_stars constraint in the migration SQL to properly enforce the rating range.
🧹 Ran the migration and reseeded the database to apply the changes.
🕵️ Also refined the reviews logic to default the name to “Anonymous” when one isn’t provided.
This new validation infrastructure enhances data safety and gives us a consistent, clean way to validate user input throughout the application.
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.
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.