This video demonstrates adding a second middleware (auth) along with how to build out orders and stringing them together.
- [Instructor] Now let's figure out Authentication.…First, since it is Middleware,…we can build out the existing class…based on a Logging Middleware.…So we can go to our Middleware folder here.…Let's create a new one called Authentication.…And the best part is, since middleware has to be structured…exactly the same,…we can take our logging middleware,…copy,…paste it over to Authentication…and rename it.…We'll delete the actual logging portion.…Now, this is completely valid middleware.…
This doesn't do anything yet…but we've got the basis of what we're going to do.…Now, a lot of people's first impulse…will be to build the authentication check right here.…Build it directly into the middleware.…While it would technically work,…that's not where it belongs.…If you think about it, authentication is a user function.…Therefore, it should probably be on a user class.…So let's go over to our Models folder.…And we'll create a new file called, User.…Just User.php.…And once again, if we look at our Message Class,…we'll realize this is very reusable.…
Author
Released
10/10/2016This 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.
- 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
Skill Level Beginner
Duration
Views
Related Courses
-
PHP 7 New Features
with Kevin Skoglund1h 4m Intermediate -
PHP Date and Time Essential Training
with David Powers4h 31m Intermediate -
PHP: Managing Persistent Sessions
with David Powers2h 41m Intermediate
-
Introduction
-
Welcome49s
-
What you should know2m 5s
-
Useful tools for this course3m 45s
-
-
1. Project Explanation and Goals
-
The Request-Response Flow3m 44s
-
Setup the database1m 48s
-
2. Authentication Options and Tradeoffs
-
Cross framework middleware1m 32s
-
3. Create a Read-Write API
-
Create a read-write API4m 49s
-
Delete API3m 43s
-
-
4. File Uploads via API
-
File uploads via API1m 43s
-
Wire up the file move5m 35s
-
-
5. Scale Your API
-
Scale your API4m 12s
-
Manage complex API routes4m 13s
-
-
Conclusion
-
Next steps1m 46s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: API authentication middleware