- Docker
-
Firstly clone the project from git repo.
https://github.com/mkawsar/laravel-redis.git
-
Build the docker images and container with following the command
- Go to the project directory
cd {projectDir}
docker-compose up --build -d
- Go to the project directory
-
Run the following the command for project server run
docker-compose run app cp .env.example .env
docker-compose run app composer install
docker-compose run app php artisan key:generate
-
Finally following the REST api endpoint
-
Store data (
POST
):0.0.0.0:8101/api/values
- Example (
JSON
):{"item1": "test 1", "item2": "test 2"}
- Example (
-
Get all data (
GET
):0.0.0.0:8101/api/values
-
Get store data using keys url params (
GET
):- Example (
Url params
):0.0.0.0:8101/api/value?keys=item1,item2
- Example (
-
Update the data (
PATCH
):0.0.0.0:8101/api/values
- Example (
JSON
):{"item1": "test 1", "item2": "test 2"}
- Example (
-
-
PHPUnit test:
docker-compose run app composer test
- php:^7.2
- redis:5.0.7
-
Firstly clone the project from git repo.
https://github.com/mkawsar/laravel-redis.git
-
Then copy the .env.example following
cd ${projectDir}
cp .env.example .env
-
Setup the Redis host and port in the .env file
-
Install the project dependency
composer install
-
Finally run the project following the command
php artisan server
-
Following the REST api
-
Store data (
POST
):127.0.0.1:8000/api/values
- Example (
JSON
):{"item1": "test 1", "item2": "test 2"}
- Example (
-
Get all data (
GET
):127.0.0.1:8000/api/values
-
Get store data using keys url params (
GET
):- Example (
Url params
):127.0.0.1:8000/api/value?keys=item1,item2
- Example (
-
Update the data (
PATCH
):127.0.0.1:8000/api/values
- Example (
JSON
):{"item1": "test 1", "item2": "test 2"}
- Example (
-
-
PHPUnit test:
composer test
REST api status code:
200
: Request is successfully done201
: Successfully stored data204
: No content found