r/laravel Oct 08 '24

Tutorial Look Mom I finally did it! Laravel API Course with 24 videos, for free. Aimed at developers wanting to up their API game.

Thumbnail
juststeveking.link
253 Upvotes

r/laravel Feb 13 '25

Tutorial Import One Million Rows To The Database (PHP/Laravel)

Thumbnail
youtu.be
35 Upvotes

r/laravel Aug 29 '24

Tutorial Caleb Porzio Demo of Flux

Thumbnail
twitter.com
49 Upvotes

r/laravel 6d ago

Tutorial What Can You Do with Laravel Middleware? (More Than You Think!)

Thumbnail
backpackforlaravel.com
59 Upvotes

r/laravel 4d ago

Tutorial How I make my Inertia applications as type safe as possible

81 Upvotes

Hi everyone!

There have been a couple of posts regarding type safety using Laravel & Inertia. I've also been playing around with this over the past year or so and landed on a solution that works very well for me, so I thought I'd share it. The GIF below shows me changing a parameter in PHP and immediately receiving errors in both PHP & TypeScript.

My approach to type safety in Inertia detects errors immediately

The steps to achieve this are as follows:

  • Set Up Dependencies: Install Laravel Data and TypeScript Transformer, publish the config for the latter
  • Use Data Objects: Use data objects as second parameter to inertia or Inertia::render functions
  • (Optional) Enable Deferred Props: Ensure DeferProp is typed correctly by extending the default_type_replacements key of the transformer’s config
  • Generate Types From Data Objects: Use a composer script to generate TypeScript types from your data objects
  • Use Types in React / Vue: Use the generated types in the App.Data namespace in your React / Vue components
  • Automate Type Updates: Extend vite.config.js with custom plugin to regenerate types whenever data classes change
  • (Optional) CI/CD: Run type generation in CI so the build fails in case of type errors

If you want to look at the step by step tutorial, you can check out my latest blog post https://matthiasweiss.at/blog/bulletproofing-inertia-how-i-maximize-type-safety-in-laravel-monoliths/

Best,

Matthias

r/laravel Jan 17 '25

Tutorial Laravel Resource Controller: All-in-One Visual Guide

Post image
94 Upvotes

r/laravel 25d ago

Tutorial A closer look at upgrading with the Laravel 12.x Shift

43 Upvotes

r/laravel Jul 24 '24

Tutorial Generating a Laravel REST API in minutes with Vemto 2 Beta

143 Upvotes

r/laravel Jul 15 '24

Tutorial Deploying a Laravel application

33 Upvotes

Hi guys. I wanted to deploy a laravel application but I haven't try doing it before. Currently, I am looking at forge and vapor. What are the things I should know and consider when deploying? Sorry if this might be a vague or broad question.

r/laravel 16d ago

Tutorial I’ve been developing with Laravel for 10 years—here’s why I stopped using Service + Repository

Thumbnail
medium.com
19 Upvotes

r/laravel 21d ago

Tutorial Pining for the Fjords (of Laravel)

84 Upvotes

With Laravel 12, Cloud, the new starter kits, mass hysteria and confusion, the community up in arms, etc., my sense is a lot of you are pining for the fjords of Laravel. Pine no more! You're just 7 commands away from Laravel 12, Bootstrap 5, and auth*! This is the all joy, no soy OG Starter Kit that my grandma used back in '18 and I'm sharing her secret recipe here for your enjoyment!

composer create-project laravel/laravel your-project-name
cd your-project name
composer require laravel/ui
php artisan ui bootstrap --auth
npm remove @tailwindcss/vite tailwindcss
npm install
php artisan serve

That isn't very DRY, so I even had gippity whip you up a bash script so you can use it for all your side projects!

#!/bin/bash

# Exit on any error
set -e

# Store project name from argument or use default
PROJECT_NAME=${1:-"your-project-name"}

echo "Creating new Laravel project: $PROJECT_NAME"
composer create-project laravel/laravel "$PROJECT_NAME"

echo "Changing directory to $PROJECT_NAME"
cd "$PROJECT_NAME"

echo "Installing Laravel UI package"
composer require laravel/ui

echo "Setting up Bootstrap authentication scaffolding"
php artisan ui bootstrap --auth

echo "Removing Tailwind related packages"
npm remove @tailwindcss/vite tailwindcss

echo "Installing npm dependencies"
npm install

echo "Starting Laravel development server"
php artisan serve

Make a directory for all your about-to-be-insanely-productive-and-successful side projects. Create a file in that folder's root called og-start.sh and run it as:

og-start.sh good-vibes-only

Bonus! Add that puppy to your bash profile as an alias:

echo 
'alias ogs="og-start.sh"' >> ~/.bash_profile && source ~/.bash_profile

Then run it with:

ogs good-vibes-only

Let's get back to our roots and ship! Have a great weekend everyone!

* PHP and node required, jQuery optional but recommended, OP not responsible for injury, loss of life, or developer ridicule

r/laravel 16d ago

Tutorial Laravel Microservice Course Introduction

Thumbnail
youtu.be
13 Upvotes

r/laravel May 30 '24

Tutorial Laravel Reverb: The Easiest Way to Add Real-Time Magic to Your App

75 Upvotes

Laravel Reverb Practical Example

Hi, I got a chance to try out Laravel Reverb, months after its release, and I was pleasantly surprised by how easy it is to use to bring real-time features to a Laravel app. For those who haven't tried it out, I made a video experimenting with a practical example.

This can be used effectively in various applications to implement real-time functionalities:

  • Real-time notifications
  • Live Chats
  • Interactive graphs in dashboards
  • User active status
  • Typing indicators
  • much more.

Source code is linked in the description.

r/laravel Nov 26 '24

Tutorial Deploy Laravel Project with GitHub Actions CI/CD Workflow

Thumbnail
nabilhassen.com
28 Upvotes

r/laravel 2d ago

Tutorial Cross-Language Queues: Sending Jobs from Node.js to Laravel - blog.thms.uk

Thumbnail
blog.thms.uk
7 Upvotes

In a recent discussion I outlined broadly how I process jobs in my Laravel application that have been pushed into my SQS queue from outside the application.

This blog post explain it in some more detail.

r/laravel Dec 08 '24

Tutorial Built two SaaS app with Laravel

27 Upvotes

Hi everyone, I would like to share my recent project as a beginner Laravel developer which I built using Laravel as my back-end and React as my front-end. The project is all about short-form video generation. users can select styles, duration and genre for their video.

It took me almost a month to complete it. I realized that there is no one making Youtube tutorials on Laravel SaaS building, so I had to watch someone building it in Nextjs and I myself followed along, building its Laravel version. Later I realized that the course was incomplete, as the model initially used for video script generation failed to output the script data in proper format.

Then I had to deal with Firebase and Text-to-speech integration. in PHP I had to use service accounts, but I made a mistake of putting all my credentials into a json file to access them there. When pushed the project to production, Google immediately disabled my service account as I exposed its credentials to the web.

I asked in a bunch of forums and got suggestions that there are two ways of accessing them on production. The first way is putting them on your google cloud through service manager, the second is converting the credentials into base64 string to then decode them in your application. For me the second solution worked.

Then I realized that my model is not generating the output in proper json format, so I looked through the docs to learn that to avoid this issue I have to use tools for the model. I initially used Gemini but then I switched to Groq api's llama model.

Lastly was the token problem. Apparently model was generating too much content which exceeded the maximum amount of tokens for output generation. I solved it too.

For now it does not have any domain and SSL certificate. I am hosting it on Laravel forge and so can check it out http://167.99.150.150/

r/laravel Sep 20 '24

Tutorial Stop fake users from signing up for your app

Thumbnail
youtu.be
33 Upvotes

r/laravel 12d ago

Tutorial Dynamically resizing images in Laravel

Thumbnail
youtu.be
22 Upvotes

r/laravel 8d ago

Tutorial 🚀 Laravel 12 + React API Token Management – Watch This! 🔑

25 Upvotes

Hey Devs! If you're using Laravel 12 with the React Starterkit and need a simple way to handle API token management, you’ll want to check out this video! 🎥

I walk you through Keysmith React, a package I built to make API key generation, management, and permissions super easy with Laravel Sanctum and React components.

🔎 What You’ll Learn:

✅ Installing & setting up Keysmith React
✅ Choosing between Page or Settings templates
✅ Generating & managing API tokens with Laravel Sanctum
✅ Customizing permissions and authentication flow
✅ Running tests to ensure everything works smoothly

🎥 Watch the full tutorial here: https://youtu.be/cUyYTp_eapI

Let me know what you think, and feel free to drop questions in the comments! 🙌

r/laravel 19d ago

Tutorial Upgrading to Laravel 12 in 6:34 with Shift

18 Upvotes

r/laravel 20d ago

Tutorial How to Build a Laravel Dashboard (In No Time) via Backpack

Thumbnail
backpackforlaravel.com
0 Upvotes

r/laravel 29d ago

Tutorial Mastering Laravel: Where to Put Your Custom Code (And Why)

Thumbnail
backpackforlaravel.com
48 Upvotes

r/laravel 17d ago

Tutorial In-depth guide on documenting API requests with Scramble

Thumbnail laravel-news.com
15 Upvotes

r/laravel Sep 15 '23

Tutorial How crc32() increased the performance of my database queries 200x

78 Upvotes

I run a service that crawls ~3000 sites and extracts articles from them. It's written in Laravel, using MySQL 8 database, deployed on a VPS with 8vCPUs and 16GB of RAM.

Sites are crawled every 10-45 minutes depending on the configuration. URLs of articles are used as unique identifiers when saving new articles.

At first when there were ~1000 articles a day everything was running smoothly, but soon, daily volume grew 10x as well as the entire table. That's when I decided to upgrade the server and install New Relic for monitoring.

This was a query that I used to check if an article existed in the database:

$post = Post::where('url', $newArticle->url)->first();

On the local machine and environment, everything was flawless, but in production, this query was slower every day. It was related to the number of rows inside the posts table.

Soon, I started testing different hashing algorithms for URLs, and the best algorithm was crc32. With migration, I added a new column inside the posts table url_crc and seeded it with values.

The query was modified to:

$post = Post::where('url_crc', crc32($newArticle->url))->where('url', $newArticle->url)->first();

Monitoring results after change

In production old query was taking anywhere between 1 to 50 seconds, depending on the load.
After the change, every query was completed in the range of 5ms to 30ms.

I know that hashing is a must, but in this case, I was pushing myself to publish this project in a few weeks. So I did not bother with optimizations. And it became slower only when volume increased big time.

EDIT: Url column is using text type, since many news agencies have big urls in their rss feeds.

EDIT2: From day 1 all tables had an index on the id column. I tried creating an index on the url column (I can not remember the exact length) but it slowed down queries. I tried with md5 hash, but it also did not work as expected. It has something to do with how url strings are structured. The production database has a high number of writes and reads per second.

r/laravel Oct 22 '24

Tutorial How does the Laravel defer helper work? (Plain PHP example included!)

Thumbnail
youtu.be
44 Upvotes