State of Laravel
summary
Laravel 5.5 ships concrete features: a new optional helper avoids null checks; Horizon provides a queue UI and in-project config; jobs gain retryUntil timeouts plus Redis-backed rate-limiting and concurrency locks (examples: one job per five seconds, single-concurrency funnels); Carbon gets macros and JSON serialization hooks; a Responsible/Resource system lets routes return resources, collections, pagination, conditional fields via when/mergeWhen/whenLoaded/whenPivotLoaded, and customize headers and formats, all demonstrated working in live code.
AI-written summary · about
chapters (27)
- 0:00Start
- 0:31Laravel Horizon
- 3:55Horizon
- 5:00Time-Based Expirations
- 6:42Rate Limiting
- 7:35Rate-Limiting
- 10:07Redis Funnel
- 13:19Carbon
- 13:49Macros
- 14:36Carbon Serialization
- 15:37Responsible Objects
- 16:37Model Transformation Layer
- 17:21Make Resource
- 19:57Return Collections of Models
- 28:08Data Wrapping
- 28:52Post Relationship
- 30:46Pagination
- 31:31Return a Json Serializable Object
- 34:33Cleaning Up Conditionals
- 38:29It's True You Could Do Something like this like if I Don't Know What You Would Do that's Expensive but like if You Had To Make a Db Call for some Wild Whatever Reason and You Didn't Want To Do that Like Directly in the Array because It Was Just Going To Execute Immediately You Could Pass a Callback To Merge Win so that You Can Kind Of Defer that and that Just Further Does the Same Thing if You Return an Array and You Can Get Pretty Gnarly in Here like You Could Have a Win Here and Get Rid of that so There's Weird Stuff You Can Do I'M You Know Keep It in Check a Little Bit but I'M Just Saying You Can Kind Of Combine Them in Interesting Ways All Right so that's How You Would Merge Values in Based on some Conditional Now this Also Gets Really Useful in Relationships
- 39:07I'M Just Saying You Can Kind Of Combine Them in Interesting Ways All Right so that's How You Would Merge Values in Based on some Conditional Now this Also Gets Really Useful in Relationships so What if I Want To Always Show the Blog Posts for the Users in this Response so One Way Would Be To Do Something like this Where Like I Did Earlier I Had a New Post Collection this Post and Now We Get the Posts May Load that Relations Are Out To Make Sure I'M on the Right Route We Get the Post every Time and this Can Cause Problems As Well because It Can Sort Of Lead to N plus 1 Problems on Your Api Transformers Where every User Is Pulling all of Its Posts Individually
- 39:47And this Can Cause Problems As Well because It Can Sort Of Lead to N plus 1 Problems on Your Api Transformers Where every User Is Pulling all of Its Posts Individually and You'Re Sort Of Not Eager Loading When You Could Be on Your Relationships You'Re GonNa Have a Lot of Extra Database Queries and I Want To Get around this to in a Sort of Expressive Way and So I Built a Helper That Looks like this Where We Returned a New Post Collection but We Say When Loaded Posts so that I Only Want To Include the Posts When They'Ve Already Been Loaded When They'Re Already on this User
- 40:18So that I Only Want To Include the Posts When They'Ve Already Been Loaded When They'Re Already on this User and Now if I Do this I Don't Get the Post because I Never Loaded Them in My Controller so There's no Reason To Pull Them but Now if I Comment this Out and I Return a User Collection with all of the Users and I Eager Load in All Their Posts Then We Should Get the Post because They Were Loaded on the User at the Time so It's another Really Expressive Way To Only Do Things When Certain Conditions Are True without Breaking Up Your Transform
- 45:30And Running the Validator Validate Method at the End Which Is GonNa Throw an Exception if It Fails and Bubble All the Way Back Out and Then in Your Route You Could Have Something like You Know if You'Re Using like Implicit Binding Say You Get a User Here and You Do Something like this It's like that like You Could Do that and User Lands I Tried To Think of Ways To Make It More Automatic so that You Could Do You Can Actually Just Type in Your User Resource Here and I Haven't Quite Cracked the Best Way To Do that because
- 47:40There's Actually a Make Response Command That Makes a Response and in this Case I Have a User Response so You Can Use this as a View Presenter First Let's Just Talk about that Aspect First before We Go To Like Other Formats because some People You Have View Presenters That Sort Of Format Their Data for a View You Know if You Need Formatting Helper Methods So in this Case I Have a User Response That Works a Lot like a Resource in Fact It Even Exists within the Illuminate Http Resources Directory but What It Looks like To Return Is I Have this Present Route I'M GonNa Return a New User Response and Pass It a User
- 49:13I'M GonNa Check if the Users an Admin I'M GonNa Return some Different Css Here some Blue Css Here and Return the Response because this Is All Built on Top of that One Responsible Interface So Now if I Return this Same Response from the Web I Get the Html but like if I Were To Go into Postman and Change this Accept Header to Css and Hit the Actual Right Route Called Present Then I'M GonNa Get Whatever the I Requested from the Server so You Can't Actually Use this To Present Other Formats I Just I Wanted Like Iron It Out a Bit More and that's Why I Was Kind Of Hesitant To Show You because I Think It Is a Cool Feature and You Could Use To Serve Csv Xml Css Html Whatever Using Sort of One Osmond It's Kind Of like that Rails Method That's like Right It's like Format
- 51:15I Have like a Bored That Hasn't Maybe Several Sub Views and I Can Return those or Pass those to the View Just as Objects and Then in My Dashboard I Just Sort Of Echo Them Out like Variables so that's another Way To Use It but Yeah Give Me a Few Weeks To Kind Of Think on that More because the Read the Api Side Is More Fleshed Out but I Feel like this the Non Jason Side of Things and Mixed Formats Is Not Quite as Fleshed Out Yet Can You Use Would Be Really Useful To Use this Sort of Thing with Resources That Aren't Necessarily Backed by Eloquent Models








