- Php ^7.1
- Mysql 5.6 - Installation
- Laravel 5.7 - Install Laravel
- JWT-Auth - tymondesigns/jwt-auth
- Dingo API - dingo/api
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install software-properties-common python-software-properties
dpkg -l | grep php | tee packages.txt
: check packages installed with php and later install 7.1 variants of the samesudo apt-get install php7.1 php7.1-common
sudo apt-get install php7.1-curl php7.1-xml php7.1-zip php7.1-gd php7.1-mysql php7.1-mbstring
sudo apt-get purge php7.0 php7.0-common
: optional
- Check .env file for mysql values being used
- Login to mysql, and then run
create database hackaphonebook;
- GRANT ALL PRIVILEGES ON
hackaphonebook
.* TO 'hackaphonebook'@'localhost' IDENTIFIED BY 'password'; - Check you can login using the password:
mysql -uhackaphonebook hackaphonebook -p
- Clone respository
composer install
php artisan migrate
php artisan jwt:secret
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
php artisan serve
- mysql username, password etc
- JWT_SECRET must be set, after you run php artisan jwt:secret above
- add
API_PREFIX=api
/api/auth/register
/api/auth/login
POST
:/api/contacts/create
GET
:/api/contacts/get
GET
:/api/contacts/get/{id}
POST
:/api/contacts/update/{id}
DELETE
:/api/contacts/delete/{id}
- import hackaphonebook-localhost.postman_collection.json into postman to test routes
-
curl -X POST localhost:8000/api/auth/register
-H "Accept: application/json"
-H "Content-type: application/json"
-d "{"email": "test@email.com", "password": "password" }" -
curl -X POST localhost:8000/api/auth/login
-H "Accept: application/json"
-H "Content-type: application/json"
-d "{"email": "test@email.com", "password": "password" }"
- Run
composer test