Skip to content

Laravel

Glossary

120 terms from Laravel, in plain words, each with the chapter that teaches it.

#

$loop variable
A variable Blade gives you inside every loop; $loop->first is true on the first pass and $loop->iteration counts from 1.
.env
A file of NAME=value lines holding this computer's settings and secrets, such as the database password. It never goes into Git.
@auth / @guest
Blade directives that show different HTML to logged-in users and to guests. In the cart page, only logged-in customers see the Place order button.
@csrf
A Blade directive that adds a hidden field holding the session's CSRF token to a form. Laravel checks the token on every POST, and without it the browser shows 419 Page Expired.
@forelse
A Blade loop like @foreach that also has an @empty part, which shows when the list has nothing in it. The product list uses it to show "No products match."
@method
A Blade directive that adds a hidden field so a form, which can only send GET or POST, can make Laravel treat the request as PUT (or another method).
@props
A Blade line at the top of a component that lists the values (props) it accepts, with defaults. The layout uses it to give each page a title of 'Kettle & Crane' unless the page passes another.

A

abort() / abort_unless()
Helpers that stop a request with an error status. abort(404) always stops, while abort_unless($ok, 403) stops unless the condition is true.
actingAs
A test method that sends the next requests as a given logged-in user. Sanctum::actingAs does the same for API routes with a token.
API
A set of URLs that other programs, such as Kettle & Crane's phone app, call to get data. It answers in JSON rather than web pages.
API resource
A class whose toArray() method decides exactly which fields of a model appear in the API's JSON. This stops columns you add later from leaking out.
APP_DEBUG
A .env setting that turns on detailed error pages. It is true on your laptop and must be false on a real server so customers can't see your code and settings.
APP_ENV
A .env setting naming the kind of computer the app runs on: local for development, production for the live server.
APP_KEY
A random secret in .env that Laravel uses to encrypt cookies and sessions. Create it with php artisan key:generate, and never change it on a live server.
Artisan
Laravel's command-line tool, run as php artisan followed by a command. It serves the app, makes new classes, runs migrations and more.
Assertion
One check inside a test, such as "the status is 200" or "the page shows House Espresso." A test fails if any assertion is false.
Attribute
A note written as #[...] on a class that a framework can read. Eloquent reads #[Fillable([...])] to learn which columns may be mass assigned.
Authentication
Checking who someone is, for example with an email and password.
Authorization
Deciding what a known user may do. Anyone may browse products, but only staff may add them.
Automated test
A little code that uses your app and checks the result, so you can recheck every feature in seconds after each change.

B

Batch
All migrations run by one migrate command. migrate:rollback undoes the last batch by running their down() methods.
Bearer token
The way an app sends its Sanctum token: an Authorization header whose value is the word Bearer, a space and the token.
Blade
Laravel's template language for building HTML pages from data. Its files end in .blade.php, and lines starting with @ are directives.
Blueprint
The object a migration's closure receives as $table; each method you call on it adds a column to the table.
Breeze
Laravel's small starter kit that adds login, registration, password reset and a profile page, built with Blade.

C

Casts
A model method that converts column values to a useful type, such as 'decimal:2' for a price string like "16.00", 'boolean' for is_staff, or 'hashed' for passwords.
Certbot
A tool that gets a free HTTPS certificate and edits the Nginx settings to use it.
Closure
A function written in place and passed around, such as the code in Route::get('/hello', function () {...}). It can't see outside variables unless you list them with use (...).
Collection
A list object Eloquent returns for several rows, with handy methods such as pluck(), sum() and implode().
compact()
A PHP function that builds an array from variable names: compact('products') is ['products' => $products]. Controllers use it to pass data to views.
Component
A reusable piece of Blade used like an HTML tag, such as <x-layout>. The layout component wraps each page's content in the shared head, menu and stylesheet.
Composer
PHP's package manager, which downloads libraries such as Laravel into vendor/. Commands include create-project, require and install.
config()
A helper that reads a setting from the files in config/, as config('app.name'): file name, then key. Those files get their values from .env with env().
Controller
A class whose methods answer requests. It takes the request, asks models for data and picks a view to show.
CSRF
An attack where another site makes a visitor's browser submit a form to your app. Laravel defends with a secret token in each form, added by @csrf.
curl
A command-line tool that fetches a page or calls an API. Adding -i shows the status line and headers, and -H adds a header.

D

Dependency injection
Laravel reads the type of a method's parameter and passes in the right object. A controller that asks for Request or Cart receives one.
Deploying
Putting your app on a server where customers can reach it, such as shop.kettleandcrane.com.
Development server
A small web server started by php artisan serve for trying your app on your own computer. It is not meant for the live site.
Directive
A Blade line starting with @, a short form of a PHP control statement or helper, such as @if, @foreach and @csrf.
Dispatch
Putting a job on the queue, as in SendOrderReceipt::dispatch($order). Nothing runs until a worker picks it up.

E

Eager loading
Loading related rows up front, as in Order::with('items.product')->get(), so a loop doesn't run one query per row. It fixes the N+1 problem.
Eloquent
Laravel's ORM: each table gets a PHP model class and each row becomes an object of it.
env()
A function used inside config/ files to read a value from .env, with a fallback, as env('APP_NAME', 'Laravel').
Error page
The detailed page Laravel shows when code fails and APP_DEBUG is true, with the message, file, line and nearby code. It would help an attacker, so production turns it off.
Escaping
Turning characters like < and > into harmless text codes so user input shows as text and can't run as a script. Blade's {{ }} does this automatically.
Exception
An error thrown by code. A job that throws fails, and a database transaction that throws is rolled back.
Extension (PHP)
An optional part of PHP that is switched on in its settings. Laravel needs several, such as pdo_pgsql to talk to PostgreSQL, and php -m lists yours.

F

Facade
A class name with static-looking methods, such as Route::get, DB::transaction and Mail::raw, that Laravel passes on to a real object behind the scenes.
Factory
A class that makes model objects filled with fake but realistic data, mostly for tests.
Firewall
Rules that decide which ports on a server accept connections. For the shop only ports 80, 443 and SSH are allowed.
Flash message
A session value that lasts for the next request only, such as 'Product added.' shown once after a redirect.
Foreign key
A column that points at a row in another table, such as orders.user_id pointing at users. In a migration, foreignId()->constrained() creates one.
Framework
A bundle of ready-made parts plus rules for where your code goes, so you don't rebuild jobs every web app needs.
Front controller
The single file, public/index.php, that every request enters through. Because only public/ faces the web, nobody can download your PHP code or settings.

H

Hash
A scrambled value from a one-way function that can check a password but can't be turned back into it. Laravel stores password hashes, never the passwords.
HTTP methods
The kind of request a browser sends: GET fetches a page, POST sends form data, and PUT updates. Routes match on both the URL and the method.
HTTPS
The encrypted version of HTTP for web traffic. A server needs a certificate, which Certbot gets for free.

I

Integer cents
Keeping money as whole cents, such as 1600 for $16.00, so no rounding errors creep in. A bigger shop would do this instead of using floats as the cart does.
Interface
A promise that a class has certain methods. Implementing ShouldQueue also tells Laravel to put the job on the queue.

J

Job
A class describing one piece of work to do later, such as emailing a receipt. Dispatching it puts it on the queue.
JSON
A text format for data, such as {"open":"7:00"}, that programs exchange. Laravel turns returned arrays, models and collections into it.

L

Laravel Cloud
Laravel's own hosting service, where you don't manage a server.
Laravel Forge
A service that sets up and manages a server you rent for your Laravel app.
Laravel Herd
Optional ways to set up PHP, Composer and Laravel on your computer: Herd is a desktop app, php.new a one-line command, and the installer gives laravel new.
laravel.log
The log file in storage/logs where Laravel writes errors, and, with MAIL_MAILER=log, the emails it would have sent.

M

Mailable
A Laravel class that builds one email message, including its subject, recipients and styled view, and is created with `php artisan make:mail`. It is the usual way to send formatted emails, in contrast to `Mail::raw()`, which sends only plain text.
Maintenance mode
A state where visitors see "503 Service Unavailable" while you update the site. php artisan down turns it on and php artisan up ends it.
Mass assignment
Filling many columns of a model from one array. #[Fillable] lists which columns are allowed, so an extra field like is_staff sent by a form is refused.
Middleware
Code that runs before a controller and can let the request through or answer it itself. The auth middleware sends guests to /login.
migrate:fresh
An Artisan command that drops every table and reruns all migrations, deleting all data. With --seed it also refills the tables with the seeder.
Migration
A PHP class that changes the database schema, with up() to apply the change and down() to undo it. Migrations run in file-name (date) order.
Model
A PHP class for one table; each row becomes an object of it. In MVC it is the data, such as a Product.
MVC
The pattern Laravel uses: models hold data, views show pages and controllers sit between, taking requests and choosing a view.

N

N+1 problem
Running one extra query for each row in a loop, such as reading $item->product for every item. Eager loading fixes it.
Named route
A route given a name with ->name(). The route() helper builds its address from the name, so links follow if the URL changes.
Nginx
The web server that serves public/ and passes PHP requests to PHP-FPM.
Node.js
A program that runs JavaScript outside the browser. Breeze needs it to build styles. Install the LTS (long-term support) version.
npm
Node's package manager, like Composer for JavaScript. npm install downloads packages into node_modules/ and npm run build runs Vite.

O

old() and @error
Blade tools for showing a failed form again: old('name') gives back what the user typed, and @error('name') shows that field's message.
optimize
An Artisan command that caches settings, routes and views in files so each request does less work. optimize:clear removes the caches.
ORM
A tool that maps database tables to classes and rows to objects, so you work with PHP objects instead of writing SQL. Eloquent is Laravel's.

P

Pagination
Showing a long list one page at a time with paginate(12), rather than loading every row.
PDO
PHP's built-in way to talk to databases. Laravel uses it, so PHP needs the matching driver extension, such as pdo_pgsql.
Pest
A PHP testing tool built on PHPUnit. You write tests with test() and run them all with php artisan test.
PHP-FPM
A program that keeps PHP workers ready and runs PHP for Nginx, which doesn't run PHP itself.
Post/Redirect/Get
After saving a form, redirect (a 302 response) to a page instead of showing a result directly, so reloading can't submit the form twice.
Prop
A value passed to a Blade component as an attribute, such as title in <x-layout title="Our coffee">. A colon before it (:title) means the value is PHP.
PSR-4 autoloading
The rule that lets PHP find a class from its namespace and folder, so App\Support\Cart is loaded from app/Support/Cart.php without a manual include.

Q

Query builder
A chain of methods such as where() and orderBy() that builds a database query step by step; it runs when you finish with get(), first() or pluck().
Query string
The part of a URL after ?, such as ?max=12. In a controller, $request->query('max') reads it.
Queue
The list of jobs waiting to run. By default it is the jobs table in the database.
Queue worker
A separate process, started with php artisan queue:work, that takes jobs off the queue and runs them. Restart it after changing job code.
Queue::fake()
A test helper that records queued jobs instead of storing them, so a test can check a job was queued without running it.
queue:failed / queue:retry
queue:failed lists jobs that failed all their tries and landed in the failed_jobs table. queue:retry all puts them back on the queue.

R

RefreshDatabase
A Pest/Laravel testing trait that runs migrations first and resets the tables after each test, so every test starts empty.
Relationship
A model method linking two tables. hasMany means many rows in another table hold my id, and belongsTo means my foreign key points at one row.
Request object
The object Laravel makes for each incoming request. Adding a Request parameter to a controller method passes it in.
Route
A connection between a URL plus HTTP method and the code that answers it. Web routes live in routes/web.php.
Route model binding
Laravel sees a Model type on a method, finds the row matching the URL part (such as {product:slug}) and passes it in, or answers 404.
Route parameter
A part of a route address in braces, such as {slug}, that matches any value there and passes it to the controller method.

S

Sanctum
Laravel's package for API logins with tokens. It creates tokens and its auth:sanctum middleware checks them.
Schema builder
PHP's way to write CREATE TABLE and ALTER TABLE inside migrations. Schema::create makes a table and Schema::table changes an existing one.
Seeder
A class that puts starting data into tables, such as Kettle & Crane's five products. It runs with php artisan db:seed.
Session
Data Laravel keeps for each visitor between requests, such as their logged-in state, flash messages and cart.
Slot
The place in a Blade component where whatever is written between its opening and closing tags is inserted.
Slug
The short, readable, address-friendly name of a thing, such as speckled-blue-mug.
SMTP
The standard way to send email through a mail service. Production sets MAIL_MAILER=smtp, while development uses log.
SQLite
A small file- or memory-based database. A new Laravel app uses it by default, and tests use an in-memory one.
Status code
The number that starts every HTTP response and says how it went: 200 OK; 302 redirect to another address (after saving, or back to a form on failed validation); 401 Unauthorized (log in first, e.g. no API token); 403 Forbidden (known user, not allowed); 404 Not Found (no page there, or not your order); 419 Page Expired (missing or stale CSRF token, Laravel's own); 422 Unprocessable Content (JSON request failed validation); 503 Service Unavailable (maintenance mode).
Supervisor
A Linux program that starts processes and restarts them when they stop. It keeps queue:work running after you log out.

T

Tailwind CSS
A set of small CSS class names such as text-sm that Breeze uses to style its pages. You don't need to learn them here.
Tinker
Laravel's interactive shell that runs PHP one statement at a time with your app loaded, handy for trying models and queries.
Token
A long random string an app sends with each request to prove who it is. Sanctum stores only a hash of it, so copy it when it's created.
Trait
A bundle of methods a class pulls in with use inside the class, such as HasFactory, Queueable and HasApiTokens.
Transaction
A group of database changes that commit together or not at all. If anything throws inside DB::transaction(), every row saved is rolled back, so an order is never left without its items.

V

Validation
Checking input against rules such as required, numeric and unique before using it. If a rule fails, Laravel redirects back with errors, or answers 422 for JSON requests.
Vendor folder
The folder where Composer puts downloaded packages. Never edit it.
View
A template for one page, stored in resources/views/ and returned with view(). In MVC it is what the visitor sees.
Vite
A build tool that bundles CSS and JavaScript into public/build, run with npm run build.