Skip to content

Latest commit

 

History

History

server

                  

Laravel API Starter Kit

Server-side API Starter Kit used for data consumption (see client sample implementation here). It includes a full custom SPA admin based on Vue CoreUI (Bootstrap 4).

Features

  • SPA admin,
  • User management,
  • Impersonation feature,
  • Submissions management,
  • Mini-cms (posts and pages),
  • Rich seeders content,
  • Swagger UI for API documentation, usable for code generation (see client sample).

Laravel

Data

API

Admin

  • Full SPA based on Vue CoreUI and Bootstrap-Vue template,
  • Many useful plugins (SweetAlert2, Flatpickr, CKEditor 4, etc.),
  • Excel Export (thanks to Maatwebsite) & Batch actions integrated within DataTables,
  • CKeditor 4 configured only with the mostly common used features (autogrow, embed, horizontalrule, image2 plugins),
  • Elfinder for files management, integrated within Ckeditor 4,
  • Ziggy for client-side route naming.

Assets building, linters & code styling

Requirements

  • PHP 7.3
  • MySQL 5.7 with JSON support or PostgreSQL

For Local/Development

API Server

# install dependencies
$ composer install

# copy .env.example & configure environnement variables

# generate key
$ php artisan key:generate

# set storage symlink
$ php artisan storage:link

# publish elfinder assets
$ php artisan elfinder:publish

# migrate & seed data
$ php artisan migrate [--seed]

# start dev server at localhost:8000
$ php artisan serve

API documentation building

  • API Swagger documentation can be accessed and tested at http://localhost:8000/api/documentation.
  • Look at "OA\*" PHP annotations on API controllers (app/Api/Controllers) for enpoints and transformers (app/Transformers) for models in order to know how to build documentation.
  • PHP Annotations for PHPStorm is heavily recommended for Swagger docs autocompletion.
  • Use "L5_SWAGGER_GENERATE_ALWAYS=true" environnement variable (on local only) to autogenerate api docs.
  • If error on Swagger UI, use php artisan l5-swagger:generate to get traces.

Admin UI building

# install dependencies
yarn

# compiling admin assets with HMR support
yarn dev-server --port 9000

Admin is accessible by default at http://localhost:8000/admin, but path can be customized via APP_ADMIN_PATH environment variable.

Deploy

See global README

Code styling

PHP-CS-Fixer & ESLint+Prettier are used for style guidelines for both server and client side code.

PHP is pre-configured for official Laravel styling, just launch ./vendor/bin/php-cs-fixer fix for global project auto-formatting.

JS use Prettier Standard Style & eslint-loader is used within webpack for dynamic code styling recommendations.
Moreover, Official ESLint plugin for Vue.js is included for heavy consistent code through all components vue files.

License

This project is open-sourced software licensed under the MIT license.