وبلاگ بلیان

نوشتن API با لومن: راهنمای عملی برای نوشتن خدمات API با PHP

Writing APIs with Lumen: A Hands-on Guide to Writing API Services With PHP

جلد کتاب نوشتن API با لومن: راهنمای عملی برای نوشتن خدمات API با PHP

معرفی کتاب «نوشتن API با لومن: راهنمای عملی برای نوشتن خدمات API با PHP» (با عنوان لاتین Writing APIs with Lumen: A Hands-on Guide to Writing API Services With PHP) نوشتهٔ Paul Redmond، منتشرشده توسط نشر 2016 در سال 2016. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

Learn to Write REST APIs from Scratch Want to learn how to write fully-tested REST APIs and microservices with PHP? I will walk you through developing an API and teach you how to test your code along the way. In this book you will learn how to use Lumen—a micro-framework by Laravel—to write bullet-proof APIs. Lumen helps you write productive, maintainable APIs using modern application design. This book is suitable for PHP developers with no Laravel experience. Only a basic understanding of HTTP and writing PHP applications is needed to get started. What's Inside the Book? You will learn how to write fully-tested APIs and understand essential Lumen concepts used to build a solid foundation for writing API projects. You will also learn: To Maintain your API's database structure through built-in database migrations Writing Tests with factory data in a test database Responding with Consistent data output in JSON How to respond to PHP Exceptions with JSON Responses How to Create, Read, Update, and Delete REST Resources How to represent model associations in API responses A solid foundation for writing tests with PHPUnit and Mockery Data Validation Table of Contents 5 Introduction 8 The Same Tools to Write APIs and Web Applications 8 Who This Book is For 8 Conventions Used in This Book 9 Tools You Will Need 11 About Me 12 Chapter 1: Installing Lumen 13 Homestead 13 Mac OSX 15 Linux 16 Windows 19 Conclusion 20 Chapter 2: Hello Lumen 21 2.1: Setting Up a New Project 21 2.2: Routes 23 2.3: Middleware and Responses 26 2.4: Views 30 Onward 32 Chapter 3: Creating the Book Application 33 Build Something Amazing 33 Environment Setup 36 Checking Unit Tests 40 Setup Complete 41 Chapter 4: Starting the Books API 42 Creating the First Endpoint 42 Setting up Models and Seed Data 46 Eloquent Books 52 Success 54 Chapter 5: Creating, Reading, Updating, and Deleting Books 55 5.1: Requesting an Individual Book 55 5.2: Creating a New Book 65 5.3: Updating an Existing Book 74 5.4: Deleting books 81 Conclusion 93 Chapter 6: Responding to Errors 95 6.1: Test Database 95 6.2: Better Error Responses 101 6.3: Testing the Exception Handler 106 Conclusion 123 Chapter 7: Leveling Up Responses 125 7.1: Introducing Fractal 125 7.2: First Version of API Response Formatting 127 7.2: The FractalResponse Class 135 7.3: FractalResponse Service 153 7.4: Integrating the FractalResponse Service 157 Conclusion 170 Chapter 8: Validation 171 8.1: First Attempt at Validation 171 8.2: More Validation Constraints 177 8.3: Custom Validation Messages 180 Conclusion 182 Chapter 9: Authors 183 9.1: The Authors database schema 183 9.2: Fixing Broken Tests 193 Conclusion 216 Chapter 10: The /authors API Resource 217 10.1: The GET /authors Endpoint 218 10.2: The GET /authors/{id} Endpoint 223 10.3: The POST /authors Endpoint 236 10.4: The PUT /authors/{id} Endpoint 246 10.5: The DELETE /authors/{id} Endpoint 258 Conclusion 259 Chapter 11: Book Bundles 260 11.1: Defining the Relationship Between Books and Bundles 260 11.2: The GET /bundles/{id} Endpoint 267 11.3: Adding a Book to a Bundle 276 11.4: Remove a Book from a Bundle 278 Conclusion 280 Chapter 12: Ratings 281 12.1: Database Design 281 12.2: Rating an Author 286 12.3: Ratings in the Author API 303 12.4: Eager Loading Ratings 309 Conclusion 310 Where To Go From Here 311 Laravel 311 Laracasts 312 Mockery 312 Guzzle 312
دانلود کتاب نوشتن API با لومن: راهنمای عملی برای نوشتن خدمات API با PHP