Этот материал находится в платной подписке. Оформи премиум подписку и смотри или слушай APIs in PHP: from Basic to Advanced, а также все другие курсы, прямо сейчас!
Премиум
  • Урок 1. 00:01:24
    Introduction and welcome: how to get the most out of the course
  • Урок 2. 00:01:27
    Install a package with a web server, PHP, a database server and phpMyAdmin
  • Урок 3. 00:00:52
    Install Composer: manage third-party packages and autoload class files
  • Урок 4. 00:03:58
    What is an API?
  • Урок 5. 00:02:57
    Make an API call: access an API from PHP
  • Урок 6. 00:04:00
    Decode API results: reading JSON in PHP
  • Урок 7. 00:04:13
    Use API data in a web application
  • Урок 8. 00:05:02
    Use cURL instead of file_get_contents to make an API request
  • Урок 9. 00:05:09
    Response codes: get the HTTP status code
  • Урок 10. 00:03:49
    Request headers: add meta data about the request
  • Урок 11. 00:02:56
    Response headers: read meta data about the response
  • Урок 12. 00:03:55
    Get all individual response headers in an array
  • Урок 13. 00:03:25
    Use an API that requires a specific request header
  • Урок 14. 00:03:44
    Request method: change the method to get a different result with the same URL
  • Урок 15. 00:03:33
    Request body: add a payload to send data along with the request
  • Урок 16. 00:03:41
    REST and RESTful APIs: what are they?
  • Урок 17. 00:03:52
    Access a RESTful API in PHP with cURL
  • Урок 18. 00:05:07
    Use the Guzzle HTTP client for object-oriented API code
  • Урок 19. 00:05:41
    Use an SDK: compare the Stripe API to its SDK
  • Урок 20. 00:03:31
    Start writing the API: enable URL rewriting
  • Урок 21. 00:04:19
    The front controller: get the resource, ID and the request method
  • Урок 22. 00:03:42
    Use a client for API development: cURL, Postman or HTTPie
  • Урок 23. 00:04:23
    Set the HTTP status code: best practices
  • Урок 24. 00:04:44
    Add a controller class to decide the response
  • Урок 25. 00:02:56
    Use Composer's autoloader to load classes automatically
  • Урок 26. 00:03:22
    Make debugging easier: add type declarations and enable strict type checking
  • Урок 27. 00:05:36
    Always return JSON: add a generic exception handler and JSON Content-Type header
  • Урок 28. 00:04:42
    Send a 405 status code and Allow header for invalid request methods
  • Урок 29. 00:02:11
    Create a new database and a database user to access it
  • Урок 30. 00:01:34
    Create a table to store resource data
  • Урок 31. 00:04:39
    Connect to the database from PHP: add a Database class
  • Урок 32. 00:04:08
    Move the database connection data to a separate .env file
  • Урок 33. 00:03:39
    Create a table data gateway class for the resource table
  • Урок 34. 00:03:18
    Show a list of all records
  • Урок 35. 00:02:34
    Configure PDO to prevent numeric values from being converted to strings
  • Урок 36. 00:02:39
    Convert database booleans to boolean literals in the JSON
  • Урок 37. 00:02:56
    Show an individual record
  • Урок 38. 00:03:58
    Respond with 404 if the resource with the specified ID is not found
  • Урок 39. 00:05:34
    Get the data from the request as JSON
  • Урок 40. 00:05:06
    Insert a record into the database and respond with a 201 status code
  • Урок 41. 00:02:53
    Add a generic error handler to output warnings as JSON
  • Урок 42. 00:04:37
    Validate the data and respond with a 422 status code if invalid
  • Урок 43. 00:03:18
    Conditionally validate the data when updating an existing record
  • Урок 44. 00:04:51
    Get the data from the request for updating an existing record
  • Урок 45. 00:05:40
    Update the record in the database and return a 200 status code
  • Урок 46. 00:02:25
    Delete the record in the database and return a 200 status code
  • Урок 47. 00:03:41
    Create a table to store user account data
  • Урок 48. 00:06:11
    Add a register page to insert a new user record and generate a new API key
  • Урок 49. 00:03:05
    Send the API key with the request: query string or request header
  • Урок 50. 00:01:44
    Check the API key is present in the request and return 400 if not
  • Урок 51. 00:02:30
    Create a table data gateway class for the user table
  • Урок 52. 00:02:17
    Authenticate the API key and return a 401 status code if invalid
  • Урок 53. 00:04:46
    Refactor the front controller to a bootstrap file and Auth class
  • Урок 54. 00:02:11
    Add a foreign key relationship to link task records to user records
  • Урок 55. 00:02:25
    Retrieve the ID of the authenticated user when authenticating
  • Урок 56. 00:02:30
    Restrict the tasks index endpoint to only show the authenticated user's tasks
  • Урок 57. 00:04:32
    Restrict the rest of the task endpoints to the authenticated user's tasks
  • Урок 58. 00:02:04
    Cache the database connection to avoid multiple connections in the same request
  • Урок 59. 00:02:28
    An introduction to authentication using access tokens
  • Урок 60. 00:03:19
    Create the login script and return 400 if the username and password are missing
  • Урок 61. 00:02:52
    Select the user record based on the username in the request
  • Урок 62. 00:02:24
    Check the username and password and return a 401 status code if invalid
  • Урок 63. 00:03:34
    Generate an encoded access token containing the user details
  • Урок 64. 00:05:20
    Pass the access token to the task API endpoints in the authorization header
  • Урок 65. 00:05:36
    Validate the access token and decode its contents
  • Урок 66. 00:04:04
    Get the authenticated user data from the access token
  • Урок 67. 00:03:49
    An introduction to JSON web tokens (JWTs)
  • Урок 68. 00:05:16
    Create a class to encode a payload in a JWT
  • Урок 69. 00:02:20
    Generate a JWT access token in the login endpoint containing JWT claims
  • Урок 70. 00:05:35
    Add a method to decode the payload from the JWT
  • Урок 71. 00:01:52
    Pass in the secret key used for hashing as a dependency
  • Урок 72. 00:03:41
    Authenticate the task endpoints using the JWT
  • Урок 73. 00:02:30
    Use a custom exception class to return 401 if the signature is invalid
  • Урок 74. 00:02:55
    Don't store sensitive data in the JWT
  • Урок 75. 00:03:13
    Why access tokens need to expire and how to refresh them in a user-friendly way
  • Урок 76. 00:02:15
    Add an expiry claim to the access token payload when logging in
  • Урок 77. 00:02:20
    Throw a custom exception to not accept the JWT if it has expired
  • Урок 78. 00:02:07
    Issue a refresh token in addition to the access token when logging in
  • Урок 79. 00:03:42
    Add a refresh endpoint and validate the refresh token in the request
  • Урок 80. 00:03:12
    Validate the user in the refresh token using the database
  • Урок 81. 00:02:26
    Issue a new access token and refresh token to the authenticated user
  • Урок 82. 00:02:20
    Create a table to store a refresh token whitelist
  • Урок 83. 00:03:49
    Store the refresh token in the whitelist when issued in the login endpoint
  • Урок 84. 00:02:51
    Replace the refresh token in the whitelist when issued in the refresh endpoint
  • Урок 85. 00:03:16
    Validate the refresh token is on the whitelist and return a 400 response if not
  • Урок 86. 00:04:19
    Add a logout endpoint to remove the an active refresh token from the whitelist
  • Урок 87. 00:03:53
    Add a script to clear out expired refresh tokens from the whitelist
  • Урок 88. 00:03:35
    See how a single-page application interacts with the API using access tokens
  • Урок 89. 00:01:22
    Conclusion & where to go from here