Secured RESTful API with CodeIgniter and JSON Web Tokens.
The growing use and applications of cloud services necessitates a more efficient architectural style than the Simple Object Access Protocol (SOAP). REST (REpresentational State Transfer) allows for a light-weight, stateless communication between clients and the Application Programming Interface (API). Because the communication is stateless, access control for Restful APIs is based on tokens which carry enough information to determine whether or not the client is authorized to perform the requested action on the resource.
I have used CodeIgniter to build a RESTful API. CodeIgniter is a powerful PHP framework with a very small footprint which allows developers to build full-scale web applications.
A list of technologies used within the project:
- PHP: Version 7.3 or higher
- Composer: Version Latest
- CodeIgniter 4: Version 4.0.0
- Firebase/PHP-JWT: Version 5.4
Step 1: Clone the repository
$ git clone https://github.com/mohsin-shaikh/rest-api.git
$ cd rest-api
$ code .
Step 2: Copy env as .env and Setup the database
$ cp env .env
Step 3: Run composer install
$ composer install
Step 4: Run the database migration
$ php spark migrate
Step 5: Run the database seed
$ php spark db:seed Client
$ php spark db:seed Product
Step 6: Run Server
$ php spark serve