This video discusses how to refactor our existing routes into resource-specific approaches to make them reusable and easier to understand.
- [Teacher] Now to be blunt,…we have a bit of a mess on our hands.…Throughout development, we've been focused…on getting things done, not being neat and tidy.…I know your development practices…are better than mine are here,…but just in case, let's show how we'd refactor our routes…to something more consistent and organized using a group.…Once in the group, we're going to start…refactoring everything together.…So first, we come into here,…and we add our group functionality.…So we say app, group, and we wanna lay out…the base route for this entire group.…
So in this case, we'll say messages.…We'll go ahead and wire the function in,…just like we have every other time.…And now we need to go ahead and fill it with things.…So in this case, let's map the GET verb directly to this.…So we'll go ahead and wire this in,…accepting the request, the response, and the args.…There's one more thing we need to do here.…We need to go ahead and wrap this.…And now optionally, we can give it a name.…So just for sanity sake, let's go ahead…
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.
- 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 Intermediate
PHP Date and Time Essential Trainingwith David Powers4h 31m Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
1. Project Explanation and Goals
2. Authentication Options and Tradeoffs
Cross framework middleware1m 32s
3. Create a Read-Write API
4. File Uploads via API
5. Scale Your API
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.Cancel
Take 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.