composer install
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=NOMBRE_BD
DB_USERNAME=NOMBRE_DE_USUARIO
DB_PASSWORD=CONTRASEÑA_DE_USUARIO
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
php artisan key:generate
Utilizar el siguiente comando para crear las rutas, modelos, controladores, etc. Para esto es necesario poner en primer lugar en singular y en ingles (por ejemplo usuario se usa User) y luego el nombre de la tabla que debio ser modelada en plural y todos sus elementos en ingles (por ejemplo usuario se usa users)
php artisan infyom:api_scaffold User --fromTable --tableName=users --save
php artisan serve
localhost:8000/api/docs
localhost:8000
localhost:8000/api/users
Antes: Route::resource('users', 'UserAPIController');
Despues: Route::resource('v1/users', 'UserAPIController');
- Execute
composer require appointer/swaggervel --dev
within your laravel root directory - Add
Appointer\Swaggervel\SwaggervelServiceProvider::class
to your providers array inapp/config/app.php
above your route provider, to avoid any catch-all routes - Run
php artisan vendor:publish --tag=public
to push swagger-ui to your public folder (can be found in public/vendor/swaggervel). - Optionally run
php artisan vendor:publish --tag=config
to push the swaggervel default config into your application's config directory. - Optionally run
php artisan vendor:publish --tag=views
to push the swaggervel index view file intoresources/views/vendor/swaggervel
.