- API Basics
- Request and Response using cURL - (api.weatherapi.com)
- curl_setopt_array()
- curl_exec()
- curl_getinfo()
- REST and REST API using cURL (api.github.com)
- Guzzle (external library) - install using composer
- Stripe SDK (external library provided by Stripe) - install using composer
- Build a framework to access API
- URL Rewriting using .htaccess file
- Simple Routing using $_SERVER superglobal variable
- Creating Controller class - (TaskController) to process reqeuests.
- HTTP status codes - best practices
- Catch errors using default exception handler
- Return JSON response using json_encode() and json_decode()
- Retrieve Data from Database in JSON (using PDO)
- Create a Separate class for accessing the database using PDO
- Injecting the instance of the class into the Controller to retrieve data from database
- Storing config data into .env file - install "vlucas/dotenv" using composer
- Create RESTFul APIs to perform CRUD operations
- Generic ErrorHandler class to return error in json
- Insert a Record and return 201 status code
- Validate data and return 422 status code for invalid parameters
- Delete Record and return 200 status code.
- Return 405 status code, if the request is not among GET, POST,PATCH, PUT, DELETE
- Return 404 status code, if the resource is not found
- Create API authentication
- Create a User with plain register page and display their API key.
- Generate API key which is randomly generated 32bit characters with randombytes() function and bin2hex() function.
- Store the generated API key in the database for authentication
- Bootstrap the code to remove repeated code.
- Create Auth Class for authentication
- Restrict the endpoints based on the user's API Key.
pdas544/api-tutorial-php
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|