Leanpub Header

Skip to main content

Laravel Master Docs

Bleeding edge version created from master branch of official documentation

This book is an up-to-date compilation of the official documentation pages, for development version of Laravel, hosted on http://laravel.com/docs to help the community to have an easy to read & organized offline documentation that can be used as a portable reference.
Free With Membership

With Membership

Free!

$7.99

You pay

$7.99

Author earns

$6.39
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
252
Readers
875
Pages
About

About

About the Book

This book is an up-to-date compilation of the official documentation pages hosted on http://laravel.com/docs to help the community to have an easy to read & organised offline documentation that can be used as a portable reference.

I will try my best to keep this book in sync with the official documentation by reviewing the changes in documentation repo periodically. If you find any error in the documentation or want to contribute, please feel free to fork the documentation repo in github and send pull request with corrections/enhancements. When your pull request will be accepted & merged into the repo, those updates will automatically be available in this book through next periodic sync.

Share this book

Categories

License

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

Author

About the Author

M N Islam Shihan

Founder & CTO at Sphinx Corporation

An accomplished Software Engineer & Leader specializing in Object-Oriented Design and Analysis with extensive experience in the full life cycle of the software design process including requirement analysis, prototyping, proof of concept, design of application, platform and user interface architecture design, implementation, testing and maintenance. Additional expertise includes project management and strong communication skills on both technical and business domains.

Social Profiles

Contents

Table of Contents

## Prologue {#—prologue}

Release Notes

  1. Versioning Scheme
  2. Support Policy
  3. Laravel 5.5 (LTS)

Upgrade Guide

  1. Upgrading To 5.5.0 From 5.4

Contribution Guide

  1. Bug Reports
  2. Core Development Discussion
  3. Which Branch?
  4. Security Vulnerabilities
  5. Coding Style
  6. ## Getting Started {#—getting-started}

Installation

  1. Installation
  2. Web Server Configuration

Configuration

  1. Introduction
  2. Environment Configuration
  3. Accessing Configuration Values
  4. Configuration Caching
  5. Maintenance Mode

Directory Structure

  1. Introduction
  2. The Root Directory
  3. The App Directory

Laravel Homestead

  1. Introduction
  2. Installation & Setup
  3. Daily Usage
  4. Network Interfaces
  5. Updating Homestead
  6. Old Versions
  7. Provider Specific Settings

Laravel Valet

  1. Introduction
  2. Installation
  3. Serving Sites
  4. Sharing Sites
  5. Custom Valet Drivers
  6. Other Valet Commands

Deployment

  1. Introduction
  2. Server Configuration
  3. Optimization
  4. Deploying With Forge
  5. ## Architecture Concepts {#—architecture-concepts}

Request Lifecycle

  1. Introduction
  2. Lifecycle Overview
  3. Focus On Service Providers

Service Container

  1. Introduction
  2. Binding
  3. Resolving
  4. Container Events
  5. PSR-11

Service Providers

  1. Introduction
  2. Writing Service Providers
  3. Registering Providers
  4. Deferred Providers

Facades

  1. Introduction
  2. When To Use Facades
  3. How Facades Work
  4. Real-Time Facades
  5. Facade Class Reference

Contracts

  1. Introduction
  2. When To Use Contracts
  3. How To Use Contracts
  4. Contract Reference
  5. ## The Basics {#—the-basics}

Routing

  1. Basic Routing
  2. Route Parameters
  3. Named Routes
  4. Route Groups
  5. Route Model Binding
  6. Form Method Spoofing
  7. Accessing The Current Route

Middleware

  1. Introduction
  2. Defining Middleware
  3. Registering Middleware
  4. Middleware Parameters
  5. Terminable Middleware

CSRF Protection

  1. Introduction
  2. Excluding URIs From CSRF Protection
  3. X-CSRF-TOKEN
  4. X-XSRF-TOKEN

Controllers

  1. Introduction
  2. Basic Controllers
  3. Controller Middleware
  4. Resource Controllers
  5. Dependency Injection & Controllers
  6. Route Caching

HTTP Requests

  1. Accessing The Request
  2. Input Trimming & Normalization
  3. Retrieving Input
  4. Files
  5. Configuring Trusted Proxies

HTTP Responses

  1. Creating Responses
  2. Redirects
  3. Other Response Types
  4. Response Macros

Views

  1. Creating Views
  2. Passing Data To Views
  3. View Composers

URL Generation

  1. Introduction
  2. The Basics
  3. URLs For Named Routes
  4. URLs For Controller Actions
  5. Default Values

HTTP Session

  1. Introduction
  2. Using The Session
  3. Adding Custom Session Drivers

Validation

  1. Introduction
  2. Validation Quickstart
  3. Form Request Validation
  4. Manually Creating Validators
  5. Working With Error Messages
  6. Available Validation Rules
  7. Conditionally Adding Rules
  8. Validating Arrays
  9. Custom Validation Rules

Errors & Logging

  1. Introduction
  2. Configuration
  3. The Exception Handler
  4. HTTP Exceptions
  5. Logging
  6. ## Frontend {#—frontend}

Blade Templates

  1. Introduction
  2. Template Inheritance
  3. Components & Slots
  4. Displaying Data
  5. Control Structures
  6. Including Sub-Views
  7. Stacks
  8. Service Injection
  9. Extending Blade

Localization

  1. Introduction
  2. Defining Translation Strings
  3. Retrieving Translation Strings
  4. Overriding Package Language Files

JavaScript & CSS Scaffolding

  1. Introduction
  2. Writing CSS
  3. Writing JavaScript

Compiling Assets (Laravel Mix)

  1. Introduction
  2. Installation & Setup
  3. Running Mix
  4. Working With Stylesheets
  5. Working With JavaScript
  6. Copying Files & Directories
  7. Versioning / Cache Busting
  8. Browsersync Reloading
  9. Environment Variables
  10. Notifications
  11. ## Security {#—security}

Authentication

  1. Introduction
  2. Authentication Quickstart
  3. Manually Authenticating Users
  4. HTTP Basic Authentication
  5. Adding Custom Guards
  6. Adding Custom User Providers
  7. Events

API Authentication (Passport)

  1. Introduction
  2. Installation
  3. Configuration
  4. Issuing Access Tokens
  5. Password Grant Tokens
  6. Implicit Grant Tokens
  7. Client Credentials Grant Tokens
  8. Personal Access Tokens
  9. Protecting Routes
  10. Token Scopes
  11. Consuming Your API With JavaScript
  12. Events
  13. Testing

Authorization

  1. Introduction
  2. Gates
  3. Creating Policies
  4. Writing Policies
  5. Authorizing Actions Using Policies

Encryption

  1. Introduction
  2. Configuration
  3. Using The Encrypter

Hashing

  1. Introduction
  2. Basic Usage

Resetting Passwords

  1. Introduction
  2. Database Considerations
  3. Routing
  4. Views
  5. After Resetting Passwords
  6. Customization
  7. ## Digging Deeper {#—digging-deeper}

Artisan Console

  1. Introduction
  2. Writing Commands
  3. Defining Input Expectations
  4. Command I/O
  5. Registering Commands
  6. Programmatically Executing Commands

Broadcasting

  1. Introduction
  2. Concept Overview
  3. Defining Broadcast Events
  4. Authorizing Channels
  5. Broadcasting Events
  6. Receiving Broadcasts
  7. Presence Channels
  8. Client Events
  9. Notifications

Cache

  1. Configuration
  2. Cache Usage
  3. Cache Tags
  4. Adding Custom Cache Drivers
  5. Events

Collections

  1. Introduction
  2. Available Methods
  3. Method Listing
  4. Higher Order Messages

Events

  1. Introduction
  2. Registering Events & Listeners
  3. Defining Events
  4. Defining Listeners
  5. Queued Event Listeners
  6. Dispatching Events
  7. Event Subscribers

File Storage

  1. Introduction
  2. Configuration
  3. Obtaining Disk Instances
  4. Retrieving Files
  5. Storing Files
  6. Deleting Files
  7. Directories
  8. Custom Filesystems

Helpers

  1. Introduction
  2. Available Methods
  3. Method Listing
  4. Arrays & Objects
  5. Paths
  6. Strings
  7. URLs
  8. Miscellaneous

Mail

  1. Introduction
  2. Generating Mailables
  3. Writing Mailables
  4. Markdown Mailables
  5. Previewing Mailables In The Browser
  6. Sending Mail
  7. Mail & Local Development
  8. Events

Notifications

  1. Introduction
  2. Creating Notifications
  3. Sending Notifications
  4. Mail Notifications
  5. Markdown Mail Notifications
  6. Database Notifications
  7. Broadcast Notifications
  8. SMS Notifications
  9. Slack Notifications
  10. Notification Events
  11. Custom Channels

Package Development

  1. Introduction
  2. Package Discovery
  3. Service Providers
  4. Resources
  5. Commands
  6. Public Assets
  7. Publishing File Groups

Queues

  1. Introduction
  2. Creating Jobs
  3. Dispatching Jobs
  4. Running The Queue Worker
  5. Supervisor Configuration
  6. Dealing With Failed Jobs
  7. Job Events

Task Scheduling

  1. Introduction
  2. Defining Schedules
  3. Task Output
  4. Task Hooks
  5. ## Database {#—database}

Database: Getting Started

  1. Introduction
  2. Running Raw SQL Queries
  3. Database Transactions

Database: Query Builder

  1. Introduction
  2. Retrieving Results
  3. Selects
  4. Raw Expressions
  5. Joins
  6. Unions
  7. Where Clauses
  8. Ordering, Grouping, Limit, & Offset
  9. Conditional Clauses
  10. Inserts
  11. Updates
  12. Deletes
  13. Pessimistic Locking

Database: Pagination

  1. Introduction
  2. Basic Usage
  3. Displaying Pagination Results
  4. Customizing The Pagination View
  5. Paginator Instance Methods

Database: Migrations

  1. Introduction
  2. Generating Migrations
  3. Migration Structure
  4. Running Migrations
  5. Tables
  6. Columns
  7. Indexes

Database: Seeding

  1. Introduction
  2. Writing Seeders
  3. Running Seeders

Redis

  1. Introduction
  2. Interacting With Redis
  3. Pub / Sub
  4. ## Eloquent ORM {#—eloquent-orm}

Eloquent: Getting Started

  1. Introduction
  2. Defining Models
  3. Retrieving Models
  4. Retrieving Single Models / Aggregates
  5. Inserting & Updating Models
  6. Deleting Models
  7. Query Scopes
  8. Events

Eloquent: Relationships

  1. Introduction
  2. Defining Relationships
  3. Querying Relations
  4. Eager Loading
  5. Inserting & Updating Related Models
  6. Touching Parent Timestamps

Eloquent: Collections

  1. Introduction
  2. Available Methods
  3. Custom Collections

Eloquent: Mutators

  1. Introduction
  2. Accessors & Mutators
  3. Date Mutators
  4. Attribute Casting

Eloquent: API Resources

  1. Introduction
  2. Generating Resources
  3. Concept Overview
  4. Writing Resources
  5. Resource Responses

Eloquent: Serialization

  1. Introduction
  2. Serializing Models & Collections
  3. Hiding Attributes From JSON
  4. Appending Values To JSON
  5. Date Serialization
  6. ## Testing {#—testing}

Testing: Getting Started

  1. Introduction
  2. Environment
  3. Creating & Running Tests

HTTP Tests

  1. Introduction
  2. Session / Authentication
  3. Testing JSON APIs
  4. Testing File Uploads
  5. Available Assertions

Browser Tests (Laravel Dusk)

  1. Introduction
  2. Installation
  3. Getting Started
  4. Interacting With Elements
  5. Available Assertions
  6. Pages
  7. Components
  8. Continuous Integration

Database Testing

  1. Introduction
  2. Generating Factories
  3. Resetting The Database After Each Test
  4. Writing Factories
  5. Using Factories
  6. Available Assertions

Mocking

  1. Introduction
  2. Bus Fake
  3. Event Fake
  4. Mail Fake
  5. Notification Fake
  6. Queue Fake
  7. Storage Fake
  8. Facades
  9. ## Official Packages {#—official-packages}

Laravel Cashier

  1. Introduction
  2. Configuration
  3. Subscriptions
  4. Subscription Trials
  5. Handling Stripe Webhooks
  6. Handling Braintree Webhooks
  7. Single Charges
  8. Invoices

Envoy Task Runner

  1. Introduction
  2. Writing Tasks
  3. Running Tasks
  4. Notifications

Laravel Horizon

  1. Introduction
  2. Installation
  3. Running Horizon
  4. Tags
  5. Notifications
  6. Metrics

API Authentication (Passport)

  1. Introduction
  2. Installation
  3. Configuration
  4. Issuing Access Tokens
  5. Password Grant Tokens
  6. Implicit Grant Tokens
  7. Client Credentials Grant Tokens
  8. Personal Access Tokens
  9. Protecting Routes
  10. Token Scopes
  11. Consuming Your API With JavaScript
  12. Events
  13. Testing

Laravel Scout

  1. Introduction
  2. Installation
  3. Configuration
  4. Indexing
  5. Searching
  6. Custom Engines

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub