Laravel: Up & Running. A Framework for Building Modern PHP Apps. 2nd Edition - Helion
ISBN: 978-14-920-4116-0
stron: 554, Format: ebook
Data wydania: 2019-04-01
Księgarnia: Helion
Cena książki: 189,00 zł
What sets Laravel apart from other PHP web frameworks? Speed and simplicity, for starters. This rapid application development framework and its ecosystem of tools let you quickly build new sites and applications with clean, readable code. Fully updated to cover Laravel 5.8, the second edition of this practical guide provides the definitive introduction to one of today’s mostpopular web frameworks.
Matt Stauffer, a leading teacher and developer in the Laravel community, delivers a high-level overview and concrete examples to help experienced PHP web developers get started with this framework right away. This updated edition also covers Laravel Dusk and Horizon and provides information about community resources and other noncore Laravel packages.
Dive into features, including:
- Blade, Laravel’s powerful custom templating tool
- Tools for gathering, validating, normalizing, and filtering user-provideddata
- The Eloquent ORM for working with application databases
- The role of the Illuminate request object in the application lifecycle
- PHPUnit, Mockery, and Dusk for testing your PHP code
- Tools for writing JSON and RESTful APIs
- Interfaces for filesystem access, sessions, cookies, caches, and search
- Tools for implementing queues, jobs, events, and WebSocket event publishing
Osoby które kupowały "Laravel: Up & Running. A Framework for Building Modern PHP Apps. 2nd Edition", wybierały także:
- PHP 8 Programming Tips, Tricks and Best Practices 157,37 zł, (29,90 zł -81%)
- Domain-Driven Design in PHP 135,91 zł, (29,90 zł -78%)
- PHP Microservices 135,91 zł, (29,90 zł -78%)
- Drupal 8 Module Development. Second edition 124,58 zł, (29,90 zł -76%)
- Mastering The Faster Web with PHP, MySQL, and JavaScript 124,58 zł, (29,90 zł -76%)
Spis treści
Laravel: Up & Running. A Framework for Building Modern PHP Apps. 2nd Edition eBook -- spis treści
- Preface
- What This Book Is About
- Who This Book Is For
- How This Book Is Structured
- About the Second Edition
- Conventions Used in This Book
- OReilly Online Learning
- How to Contact Us
- Acknowledgments for the First Edition
- Acknowledgments for the Second Edition
- 1. Why Laravel?
- Why Use a Framework?
- Ill Just Build It Myself
- Consistency and Flexibility
- A Short History of Web and PHP Frameworks
- Ruby on Rails
- The Influx of PHP Frameworks
- The Good and the Bad of CodeIgniter
- Laravel 1, 2, and 3
- Laravel 4
- Laravel 5
- Whats So Special About Laravel?
- The Philosophy of Laravel
- How Laravel Achieves Developer Happiness
- The Laravel Community
- How It Works
- Why Laravel?
- Why Use a Framework?
- 2. Setting Up a Laravel Development Environment
- System Requirements
- Composer
- Local Development Environments
- Laravel Valet
- Laravel Homestead
- Creating a New Laravel Project
- Installing Laravel with the Laravel Installer Tool
- Installing Laravel with Composers create-project Feature
- Lambo: Super-Powered Laravel New
- Laravels Directory Structure
- The Folders
- The Loose Files
- Configuration
- The .env File
- Up and Running
- Testing
- TL;DR
- 3. Routing and Controllers
- A Quick Introduction to MVC, the HTTP Verbs, and REST
- What Is MVC?
- The HTTP Verbs
- What Is REST?
- Route Definitions
- Route Verbs
- Route Handling
- Route Parameters
- Route Names
- Route Groups
- Middleware
- Applying middleware in controllers
- Rate limiting
- Dynamic rate limiting
- Path Prefixes
- Fallback Routes
- Subdomain Routing
- Namespace Prefixes
- Name Prefixes
- Middleware
- Signed Routes
- Signing a Route
- Modifying Routes to Allow Signed Links
- Views
- Returning Simple Routes Directly with Route::view()
- Using View Composers to Share Variables with Every View
- Controllers
- Getting User Input
- Injecting Dependencies into Controllers
- Resource Controllers
- The methods of Laravels resource controllers
- Binding a resource controller
- API Resource Controllers
- Binding an API resource controller
- Single Action Controllers
- Route Model Binding
- Implicit Route Model Binding
- Custom Route Model Binding
- Route Caching
- Form Method Spoofing
- HTTP Verbs in Laravel
- HTTP Method Spoofing in HTML Forms
- CSRF Protection
- Redirects
- redirect()->to()
- redirect()->route()
- redirect()->back()
- Other Redirect Methods
- redirect()->with()
- Aborting the Request
- Custom Responses
- response()->make()
- response()->json() and ->jsonp()
- response()->download(), ->streamDownload(), and ->file()
- Testing
- TL;DR
- A Quick Introduction to MVC, the HTTP Verbs, and REST
- 4. Blade Templating
- Echoing Data
- Control Structures
- Conditionals
- @if
- @unless and @endunless
- Loops
- @for, @foreach, and @while
- @forelse and @endforelse
- Conditionals
- Template Inheritance
- Defining Sections with @section/@show and @yield
- @extends
- @section and @endsection
- @parent
- Including View Partials
- @include
- @each
- Using Stacks
- Using Components and Slots
- Multiple slots
- Aliasing a component to be a directive
- Defining Sections with @section/@show and @yield
- View Composers and Service Injection
- Binding Data to Views Using View Composers
- Sharing a variable globally
- View-scoped view composers with closures
- View-scoped view composers with classes
- Blade Service Injection
- Binding Data to Views Using View Composers
- Custom Blade Directives
- Parameters in Custom Blade Directives
- Example: Using Custom Blade Directives for a Multitenant App
- Easier Custom Directives for if Statements
- Testing
- TL;DR
- 5. Databases and Eloquent
- Configuration
- Database Connections
- Other Database Configuration Options
- Defining Migrations
- Creating a migration
- Creating tables
- Creating columns
- Building extra properties fluently
- Dropping tables
- Modifying columns
- Indexes and foreign keys
- Adding indexes
- Removing indexes
- Adding and removing foreign keys
- Running Migrations
- Seeding
- Creating a Seeder
- Model Factories
- Creating a model factory
- Using a model factory
- Overriding properties when calling a model factory
- Generating more than one instance with a model factory
- Pro-level model factories
- Attaching relationships when defining model factories
- Defining and accessing multiple model factory states
- Query Builder
- Basic Usage of the DB Facade
- Raw SQL
- Raw selects
- Parameter bindings and named bindings
- Raw inserts
- Raw updates
- Raw deletes
- Chaining with the Query Builder
- Constraining methods
- Modifying methods
- Conditional methods
- Ending/returning methods
- Writing raw queries inside query builder methods with DB::raw
- Joins
- Unions
- Inserts
- Updates
- Deletes
- JSON operations
- Transactions
- Introduction to Eloquent
- Creating and Defining Eloquent Models
- Table name
- Primary key
- Timestamps
- Retrieving Data with Eloquent
- Get one
- Get many
- Chunking responses with chunk()
- Aggregates
- Inserts and Updates with Eloquent
- Inserts
- Updates
- Mass assignment
- firstOrCreate() and firstOrNew()
- Deleting with Eloquent
- Normal deletes
- Soft deletes
- Enabling soft deletes
- Querying with soft deletes
- Restoring soft-deleted entities
- Force-deleting soft-deleted entities
- Scopes
- Local scopes
- Global scopes
- Removing global scopes
- Customizing Field Interactions with Accessors, Mutators, and Attribute Casting
- Accessors
- Mutators
- Attribute casting
- Date mutators
- Eloquent Collections
- Introducing the base collection
- What Eloquent collections add
- Eloquent Serialization
- Returning models directly from route methods
- Hiding attributes from JSON
- Eloquent Relationships
- One to one
- One to many
- Using relationships as query builders
- Selecting only records that have a related item
- Has many through
- Has one through
- Many to many
- Getting data from the pivot table
- Polymorphic
- Many to many polymorphic
- Child Records Updating Parent Record Timestamps
- Eager loading
- Constraining eager loads
- Lazy eager loading
- Eager loading only the count
- Eager loading
- Creating and Defining Eloquent Models
- Eloquent Events
- Testing
- TL;DR
- Configuration
- 6. Frontend Components
- Laravel Mix
- Mix Folder Structure
- Running Mix
- What Does Mix Provide?
- Source maps
- Pre- and post-processors
- Preprocessorless CSS
- Concatenating JavaScript
- Processing JavaScript
- Copying files or directories
- Versioning
- Vue and React
- Hot Module Replacement
- Vendor extraction
- Environment variables in Mix
- Frontend Presets and Auth Scaffolding
- Frontend Presets
- Third-party frontend presets
- Auth Scaffolding
- Frontend Presets
- Pagination
- Paginating Database Results
- Manually Creating Paginators
- Message Bags
- Named Error Bags
- String Helpers, Pluralization, and Localization
- The String Helpers and Pluralization
- Localization
- Basic localization
- Parameters in localization
- Pluralization in localization
- Storing the default string as the key with JSON
- Testing
- Testing Message and Error Bags
- Translation and Localization
- TL;DR
- Laravel Mix
- 7. Collecting and Handling User Data
- Injecting a Request Object
- $request->all()
- $request->except() and $request->only()
- $request->has()
- $request->input()
- $request->method() and ->isMethod()
- Array Input
- JSON Input (and $request->json())
- Route Data
- From Request
- From Route Parameters
- Uploaded Files
- Validation
- validate() on the Request Object
- Manual Validation
- Custom Rule Objects
- Displaying Validation Error Messages
- Form Requests
- Creating a Form Request
- Using a Form Request
- Eloquent Model Mass Assignment
- {{ Versus {!!
- Testing
- TL;DR
- Injecting a Request Object
- 8. Artisan and Tinker
- An Introduction to Artisan
- Basic Artisan Commands
- Options
- The Grouped Commands
- Writing Custom Artisan Commands
- A Sample Command
- Arguments and Options
- Argumentsrequired, optional, and/or with defaults
- Optionsrequired values, value defaults, and shortcuts
- Array arguments and array options
- Input descriptions
- Using Input
- argument() and arguments()
- option() and options()
- Prompts
- Output
- Table output
- Progress bars
- Writing Closure-Based Commands
- Calling Artisan Commands in Normal Code
- Tinker
- Laravel Dump Server
- Testing
- TL;DR
- 9. User Authentication and Authorization
- The User Model and Migration
- Using the auth() Global Helper and the Auth Facade
- The Auth Controllers
- RegisterController
- RegistersUsers trait
- LoginController
- AuthenticatesUsers trait
- ThrottlesLogins trait
- ResetPasswordController
- ForgotPasswordController
- VerificationController
- RegisterController
- Auth::routes()
- The Auth Scaffold
- Remember Me
- Manually Authenticating Users
- Manually Logging Out a User
- Invalidating Sessions on Other Devices
- Auth Middleware
- Email Verification
- Blade Authentication Directives
- Guards
- Changing the Default Guard
- Using Other Guards Without Changing the Default
- Adding a New Guard
- Closure Request Guards
- Creating a Custom User Provider
- Custom User Providers for Nonrelational Databases
- Auth Events
- Authorization (ACL) and Roles
- Defining Authorization Rules
- The Gate Facade (and Injecting Gate)
- Resource Gates
- The Authorize Middleware
- Controller Authorization
- Checking on the User Instance
- Blade Checks
- Intercepting Checks
- Policies
- Generating policies
- Checking policies
- Overriding policies
- Testing
- TL;DR
- 10. Requests, Responses, and Middleware
- Laravels Request Lifecycle
- Bootstrapping the Application
- Laravels kernel
- Service Providers
- boot(), register(), and deferring on service providers
- Bootstrapping the Application
- The Request Object
- Getting a Request Object in Laravel
- Getting Basic Information About a Request
- Basic user input
- User and request state
- Files
- Persistence
- The Response Object
- Using and Creating Response Objects in Controllers
- Setting headers
- Adding cookies
- Specialized Response Types
- View responses
- Download responses
- File responses
- JSON responses
- Redirect responses
- Custom response macros
- The Responsable interface
- Using and Creating Response Objects in Controllers
- Laravel and Middleware
- An Introduction to Middleware
- Creating Custom Middleware
- Understanding middlewares handle() method
- Binding Middleware
- Binding global middleware
- Binding route middleware
- Using middleware groups
- Passing Parameters to Middleware
- Trusted Proxies
- Testing
- TL;DR
- Laravels Request Lifecycle
- 11. The Container
- A Quick Introduction to Dependency Injection
- Dependency Injection and Laravel
- The app() Global Helper
- How the Container Is Wired
- Binding Classes to the Container
- Binding to a Closure
- Binding to Singletons, Aliases, and Instances
- Binding a Concrete Instance to an Interface
- Contextual Binding
- Constructor Injection in Laravel Framework Files
- Method Injection
- Facades and the Container
- How Facades Work
- Real-Time Facades
- Service Providers
- Testing
- TL;DR
- 12. Testing
- Testing Basics
- Naming Tests
- The Testing Environment
- The Testing Traits
- RefreshDatabase
- WithoutMiddleware
- DatabaseMigrations
- DatabaseTransactions
- Simple Unit Tests
- Application Testing: How It Works
- TestCase
- HTTP Tests
- Testing Basic Pages with $this->get() and Other HTTP Calls
- Testing JSON APIs with $this->getJson() and Other JSON HTTP Calls
- Assertions Against $response
- Authenticating Responses
- A Few Other Customizations to Your HTTP Tests
- Handling Exceptions in Application Tests
- Database Tests
- Using Model Factories in Tests
- Seeding in Tests
- Testing Other Laravel Systems
- Event Fakes
- Bus and Queue Fakes
- Mail Fakes
- Notification Fakes
- Storage Fakes
- Mocking
- A Quick Introduction to Mocking
- A Quick Introduction to Mockery
- Faking Other Facades
- Testing Artisan Commands
- Asserting Against Artisan Command Syntax
- Browser Tests
- Choosing a Tool
- Testing with Dusk
- Installing Dusk
- Writing Dusk tests
- Authentication and databases
- Interactions with the page
- Waiting
- Other assertions
- Other organizational structures
- Pages
- Components
- TL;DR
- 13. Writing APIs
- The Basics of REST-Like JSON APIs
- Controller Organization and JSON Returns
- Reading and Sending Headers
- Sending Response Headers in Laravel
- Reading Request Headers in Laravel
- Eloquent Pagination
- Sorting and Filtering
- Sorting Your API Results
- Filtering Your API Results
- Transforming Results
- Writing Your Own Transformer
- Nesting and Relationships with Custom Transformers
- API Resources
- Creating a Resource Class
- Resource Collections
- Nesting Relationships
- Using Pagination with API Resources
- Conditionally Applying Attributes
- More Customizations for API Resources
- API Authentication with Laravel Passport
- A Brief Introduction to OAuth 2.0
- Installing Passport
- Passports API
- Passports Available Grant Types
- Password grant
- Authorization code grant
- Personal access tokens
- Tokens from Laravel session authentication (synchronizer tokens)
- Managing Clients and Tokens with the Passport API and Vue Components
- The routes
- The Vue components
- Passport Scopes
- Deploying Passport
- API Token Authentication
- Customizing 404 Responses
- Triggering the Fallback Route
- Testing
- Testing Passport
- TL;DR
- 14. Storage and Retrieval
- Local and Cloud File Managers
- Configuring File Access
- Using the Storage Facade
- Adding Additional Flysystem Providers
- Basic File Uploads and Manipulation
- Simple File Downloads
- Sessions
- Accessing the Session
- Methods Available on Session Instances
- Flash Session Storage
- Cache
- Accessing the Cache
- Methods Available on Cache Instances
- Cookies
- Cookies in Laravel
- Accessing the Cookie Tools
- The Cookie facade
- The cookie() global helper
- Cookies on Request and Response objects
- Reading cookies from Request objects
- Setting cookies on Response objects
- Logging
- When and Why to Use Logs
- Writing to the Logs
- Log Channels
- The single channel
- The daily channel
- The slack channel
- The stack channel
- Writing to specific log channels
- Full-Text Search with Laravel Scout
- Installing Scout
- Marking Your Model for Indexing
- Searching Your Index
- Queues and Scout
- Performing Operations Without Indexing
- Conditionally Indexing Models
- Manually Triggering Indexing via Code
- Manually Triggering Indexing via the CLI
- Testing
- File Storage
- Uploading fake files
- Returning fake files
- Session
- Cache
- Cookies
- Log
- Scout
- File Storage
- TL;DR
- Local and Cloud File Managers
- 15. Mail and Notifications
- Mail
- Classic Mail
- Basic Mailable Mail Usage
- Mail Templates
- Methods Available in build()
- Attachments and Inline Images
- Markdown Mailables
- Markdown components
- Rendering Mailables to the Browser
- Queues
- Local Development
- The log driver
- Mailtrap.io
- Universal to
- Notifications
- Defining the via() Method for Your Notifiables
- Sending Notifications
- Sending notifications using the Notifiable trait
- Sending notifications with the Notification facade
- Queueing Notifications
- Out-of-the-Box Notification Types
- Email notifications
- Markdown mail notifications
- Database notifications
- Broadcast notifications
- SMS notifications
- Slack notifications
- Other notifications
- Email notifications
- Testing
- Notifications
- TL;DR
- Mail
- 16. Queues, Jobs, Events, Broadcasting, and the Scheduler
- Queues
- Why Queues?
- Basic Queue Configuration
- Queued Jobs
- Creating a job
- Pushing a job onto a queue
- Customizing the connection
- Customizing the queue
- Customizing the delay
- Running a Queue Worker
- Handling Errors
- Exceptions in handling
- Limiting the number of tries
- Handling failed jobs
- Controlling the Queue
- Queues Supporting Other Functions
- Laravel Horizon
- Events
- Firing an Event
- Listening for an Event
- Event subscribers
- Broadcasting Events over WebSockets, and Laravel Echo
- Configuration and Setup
- Broadcasting an Event
- Receiving the Message
- Simple WebSockets listening with Pusher
- Advanced Broadcasting Tools
- Excluding the current user from broadcast events
- The broadcast service provider
- Binding authorization definitions for WebSocket channels
- Laravel Echo (the JavaScript Side)
- Bringing Echo into your project
- Using Echo for basic event broadcasting
- Private channels and basic authentication
- Presence channels
- Excluding the current user
- Subscribing to notifications with Echo
- Client events
- Scheduler
- Available Task Types
- Available Time Frames
- Defining Time Zones for Scheduled Commands
- Blocking and Overlap
- Handling Task Output
- Task Hooks
- Testing
- TL;DR
- Queues
- 17. Helpers and Collections
- Helpers
- Arrays
- Strings
- Application Paths
- URLs
- Miscellaneous
- Collections
- The Basics
- A Few Methods
- TL;DR
- Helpers
- 18. The Laravel Ecosystem
- Tools Covered in This Book
- Valet
- Homestead
- The Laravel Installer
- Mix
- Dusk
- Passport
- Horizon
- Echo
- Tools Not Covered in This Book
- Forge
- Envoyer
- Cashier
- Socialite
- Nova
- Spark
- Lumen
- Envoy
- Telescope
- Other Resources
- Tools Covered in This Book
- Glossary
- Index