
- Download and install WAMP or XAMPP Server
- Download and install composer
- Open Gitbash and Set the composer
- composer global require “laravel/installer”
- Create a new Laravel Project
- Refer following code
composer create-project laravel/laravel <Project Name> "5.5.*" --prefer-dist | |
# Move to new project directory: <Project Name> | |
cd <Project Name> | |
Install Passport: | |
---------------- | |
composer require paragonie/random_compat:2.* | |
composer require laravel/passport "4.0.*" | |
$ php artisan migrate | |
Migrating: 2014_10_12_000000_create_users_table | |
Migrated: 2014_10_12_000000_create_users_table | |
Migrating: 2014_10_12_100000_create_password_resets_table | |
Migrated: 2014_10_12_100000_create_password_resets_table | |
Migrating: 2016_06_01_000001_create_oauth_auth_codes_table | |
Migrated: 2016_06_01_000001_create_oauth_auth_codes_table | |
Migrating: 2016_06_01_000002_create_oauth_access_tokens_table | |
Migrated: 2016_06_01_000002_create_oauth_access_tokens_table | |
Migrating: 2016_06_01_000003_create_oauth_refresh_tokens_table | |
Migrated: 2016_06_01_000003_create_oauth_refresh_tokens_table | |
Migrating: 2016_06_01_000004_create_oauth_clients_table | |
Migrated: 2016_06_01_000004_create_oauth_clients_table | |
Migrating: 2016_06_01_000005_create_oauth_personal_access_clients_table | |
Migrated: 2016_06_01_000005_create_oauth_personal_access_clients_table | |
$ php artisan passport:install | |
Encryption keys generated successfully. | |
Personal access client created successfully. | |
Client ID: 1 | |
Client Secret: vMSs3J7dxU1RLCzSaeTMjARIhY3I3C3nIumxAaty | |
Password grant client created successfully. | |
Client ID: 2 | |
Client Secret: grK9hSGJS1jhKMGKGxUia4D6vSRGxB313FIruBsI | |
php artisan make:controller API/TestController --resource | |
php artisan make:model model/TestModel | |
$ php artisan make:migration create_test_table --create=tests | |
Created Migration: 2019_09_24_090439_create_test_table | |
$ php artisan make:seeder TestTableSeeder | |
Seeder created successfully. | |
$ php artisan make:factory TestFactory | |
Factory created successfully. | |
$ php artisan migrate | |
Migrating: 2019_09_24_090439_create_test_table | |
Migrated: 2019_09_24_090439_create_test_table | |
$ php artisan db:seed | |
Seeding: TestTableSeeder | |
Make the Changes similar to the commit given below in your project: | |
-------------------------------------------------------------------- | |
https://bitbucket.org/cotocusdevelopers/sp-microserivce-starter-kit/commits/a9276ae7c74e9568e87098ba6955e7659e2c828a | |
Test If Everything is working fine: | |
----------------------------------- | |
Refer to the link given below for steps to test your api: | |
https://bitbucket.org/cotocusdevelopers/sp-microserivce-starter-kit/src/master/README.md |
How to make a Machine to Machine call from one microservice to the other: Using Guzzle
use GuzzleHttp\Exception\GuzzleException; | |
use GuzzleHttp\Exception\RequestException; | |
use GuzzleHttp\Client; | |
public static function getTestApiRespone(string $access_token) { | |
try { | |
$http = new Client(); //GuzzleHttp\Client | |
$response = $http->get( | |
'http://surgery-planet-quote-booking/api/test', | |
[ | |
'headers' => [ | |
'Accept' => 'html', | |
'Authorization' => 'Bearer ' . $access_token | |
] | |
] | |
); | |
return $response->getBody(); | |
} catch (RequestException $e) { | |
/*Debugbar::error('Inside Helper->getQuoteBookingForm()->CATCH BLOCK'); | |
Debugbar::error($e); | |
Debugbar::error($e->getMessage()); | |
Debugbar::error('Exiting from Helper->getQuoteBookingForm()->CATCH BLOCK');*/ | |
return $e->getResponse()->getStatusCode() . ': ' . $e->getMessage(); | |
} | |
} | |
public static function getTestApiResponeWithAuth() { | |
try { | |
$http = new Client(); //GuzzleHttp\Client | |
$response = $http->post( | |
'http://surgery-planet-quote-booking/oauth/token', | |
[ | |
'form_params' => [ | |
'grant_type' => 'client_credentials', | |
'client_id' => '6', | |
'client_secret' => 'YoaLmACopaMUTZsmB4fsxtn6OEMGQj7FqZsbazwQ', | |
'redirect_uri' => '', | |
], | |
] | |
); | |
$array = $response->getBody()->getContents(); | |
$json = json_decode($array, true); | |
$collection = collect($json); | |
$access_token = $collection->get('access_token'); | |
return Helper::getTestApiRespone($access_token); | |
} catch (RequestException $e) { | |
/*Debugbar::error('Inside Helper->getQuoteBookingFormWithAuth()->CATCH BLOCK'); | |
Debugbar::error($e); | |
Debugbar::error($e->getMessage()); | |
Debugbar::error('Exiting from Helper->getQuoteBookingFormWithAuth()->CATCH BLOCK');*/ | |
return $e->getResponse()->getStatusCode() . ': ' . $e->getMessage(); | |
} | |
} | |



I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND