Skip to content

Laravel 5.5 Skeloton app, configured with Vagrant/Homestead

Notifications You must be signed in to change notification settings

kodeflex/laravel-test

Repository files navigation

laravel-test

Prerequisites

Setup

git clone [email protected]:kodeflex/laravel-test.git
cd laravel-test

Run npm i

composer install runs in background as a preinstall npm script

Start

PHP built-in Server

  • Run npm start

Vagrant/Homestead

  • Run npm run vagrant:init:<mac|win> command to initialize the devleopment environment
  • Run npm run vagrant or vagrant up
  • Run npm run vagrant:destroy or vagrant destroy to destroy the Vagrant env.

Database migrations/seed

php artisan migrate
php artisan db:seed

API with Basic Authentication

Using laravel/passport

See routes/api.php for sample routes.

Create oAuth clients

php artisan passport:client [--personal|--passowrd]

Get access_token

POST <your-ip-or-domain>/oauth/token

request-body

{
    "client_id": "<client-id>",
    "client_secret": "<client_secret>",
    "grant_type": "password",
    "scope": "*",
    "username": "<email>", 
    "password": "<password>"
}

response

{
    "token_type": "Bearer",
    "expires_in": 31535999,
    "access_token": "<access_token>"
}

Sending API request with Authorization Header

GET /api/v1/users HTTP/1.1
Host: host-ip
Accept: application/json
Authorization: Bearer <access_token>
Cache-Control: no-cache

Releases

No releases published

Packages

No packages published

Languages