Simple RESTful API using Laravel 5.5
- Clone repository on you local development machine and navigate in to cloned directory
- Install dependencies by running following command
composer install - Initialize Homestead
php vendor/bin/homestead make - Open
Homestead.yamlfile make any necessory changes - Create
.envfile (or copy from.env.example) and make desired changes i.e. database credentials etc. - Set additional property in
.envfile for pagination limitPAGE_LIMIT=3or any other desired number - Start you homestead machine
vagrant up - SSH into your homestead machine and run
cd code && php artisan migrate && php artisan db:seed - Yaay... API is up and running at homestead.test or as specified in step 4
API is tiny and slim with only one resource (messages), following are the endpoints available
- [GET]
[site-url]/api/messages - [GET]
[site-url]/api/messages/archive - [GET]
[site-url]/api/messages/{id}where id is valid message id - [POST]
[site-url]/api/messages/{id}/readwhere id is valid message id - [POST]
[site-url]/api/messages/{id}/archivewhere id is valid message id
API is protected with Basic HTTP Authentication. Users for basic auth are:
har256b/har256b