https://github.com/code4mk/lara-spa-api
🔌 Laravel SPA api for Vue | React | Angular. Secure SPA api and http status
https://github.com/code4mk/lara-spa-api
0devco android code4mk ios laravel-angular-spa laravel-react-spa laravel-spa laravel-vue-spa spa-api
Last synced: 4 months ago
JSON representation
🔌 Laravel SPA api for Vue | React | Angular. Secure SPA api and http status
- Host: GitHub
- URL: https://github.com/code4mk/lara-spa-api
- Owner: code4mk
- Created: 2019-02-26T19:25:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-01T17:00:46.000Z (almost 7 years ago)
- Last Synced: 2025-04-08T19:52:41.542Z (9 months ago)
- Topics: 0devco, android, code4mk, ios, laravel-angular-spa, laravel-react-spa, laravel-spa, laravel-vue-spa, spa-api
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# lara-spa-api
Laravel SPA api for Vue | React | Angular
# installation
```bash
composer require code4mk/lara-spa-api
```
## vendor publish
```bash
php artisan vendor:publish --provider="LSAPI\LSAPIServiceProvider" --tag=config
```
=> config/lsapi.php
# Middleware `lsapi` group
```php
Route::group(['middleware' => ['lsapi']], function () {
// spa routes
});
//or
Route::get('spa',function(){
})->middleware('lsapi');
```
# `exceptions/Handler.php`
* delete all code inside `Handler.php` and paste below code
```php
wantsJson()) {
return $this->handleLsapiException($request, $exception);
} else {
return parent::render($request, $exception);
}
}
}
```
# axios | guzzle `header`
you can change header name `Authorization` to `Anything` in `lsapi` config file.
```js
Authorization: Bearer xxxxx
Accept: application/json
```
