Building APIs in PHP Using the Slim Micro Framework

Building APIs in PHP Using the Slim Micro Framework

1h 53mIntermediate2016-10-10

Authors

Keith Casey

Keith Casey

Software development and project management

Course details

A well-designed API includes not just URLs and response codes but also authentication, consistent structures, and useful JSON payloads. Luckily, the Slim micro framework makes it easy to move an API from concept to implementation to production. What used to take weeks or even months can usually be done in hours or days with Slim.

This course begins with a simple application specification and builds it one step at a time. Each chapter includes a key concept, with examples from other public APIs, and then shows how to build it yourself with Slim. Learn about URL routing, validating input, and generating response codes and hypermedia payloads. Like any project, the first implementation may be a little messy but don't worry. The last chapter covers refactoring and what it takes to scale and support the API going forward.

Learning objectives
Understanding the project goals
Setting up the database
Adding authentication in Slim
Using cross-framework and authentication middleware
Creating a read-write API in Slim
Uploading files via the API
Adding file security
Creating payloads and response codes in Slim
Scaling your API

Skills covered

SlimPHPAPIsProjectOpen SourceSoftware Development

Concepts

Introduction

  • Welcome
  • What you should know
  • Project description and goals
  • From empty editor to Hello World
  • Useful tools for this course
  • Using the exercise files

Project Explanation and Goals

  • Routing and middleware basics
  • The Request-Response Flow
  • Routing and parameter fundamentals
  • Setup the database
  • Our first middleware component

Authentication Options and Tradeoffs

  • Authentication options and tradeoffs
  • How authentication fits into our APIs
  • Cross framework middleware
  • API authentication middleware

Create a Read-Write API

  • Create a read-write API
  • Content negotiation and content types
  • Process JSON and response codes
  • Delete API

File Uploads via API

  • File uploads via API
  • Manage files safely and securely
  • Design JSON payloads for APIs
  • Process file uploads via API
  • File security and storage in your API
  • Wire up the file move
  • Create payloads and response codes for API

Scale Your API

  • Scale your API
  • Manage complex API routes
  • Implement versioning in your API

Conclusion

  • Next steps
40,000 Toman