forked from loafle/openapi-generator-original
[PHP-Lumen] Lumen 5.6 support (#212)
* Lumen 5.6 support * recall headlines * Update composer.mustache * regenerate lumne php petstore samples * remove output format from lumen routes * Fix: "A facade root has not been set" * Ignore log folder
This commit is contained in:
parent
b1921ce484
commit
05f177b6d6
@ -99,18 +99,37 @@ public class PhpLumenServerCodegen extends AbstractPhpCodegen {
|
||||
* entire object tree available. If the input file has a suffix of `.mustache
|
||||
* it will be processed by the template engine. Otherwise, it will be copied
|
||||
*/
|
||||
supportingFiles.add(new SupportingFile(".env.example", packagePath + File.separator + srcBasePath, ".env.example"));
|
||||
supportingFiles.add(new SupportingFile("storage_logs_.gitignore", packagePath + File.separator + srcBasePath + File.separator + "storage" + File.separator + "logs", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("artisan", packagePath + File.separator + srcBasePath, "artisan"));
|
||||
supportingFiles.add(new SupportingFile("composer.mustache", packagePath + File.separator + srcBasePath, "composer.json"));
|
||||
supportingFiles.add(new SupportingFile("readme.md", packagePath + File.separator + srcBasePath, "readme.md"));
|
||||
supportingFiles.add(new SupportingFile("app.php", packagePath + File.separator + srcBasePath + File.separator + "bootstrap", "app.php"));
|
||||
supportingFiles.add(new SupportingFile("index.php", packagePath + File.separator + srcBasePath + File.separator + "public", "index.php"));
|
||||
supportingFiles.add(new SupportingFile("User.php", packagePath + File.separator + srcBasePath + File.separator + "app", "User.php"));
|
||||
supportingFiles.add(new SupportingFile("Kernel.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Console", "Kernel.php"));
|
||||
supportingFiles.add(new SupportingFile(".gitkeep", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Console" + File.separator + "Commands", ".gitkeep"));
|
||||
supportingFiles.add(new SupportingFile("Event.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Events", "Event.php"));
|
||||
supportingFiles.add(new SupportingFile("ExampleEvent.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Events", "ExampleEvent.php"));
|
||||
supportingFiles.add(new SupportingFile("Handler.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Exceptions", "Handler.php"));
|
||||
supportingFiles.add(new SupportingFile("routes.mustache", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Http", "routes.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("Controller.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "Controller.php"));
|
||||
supportingFiles.add(new SupportingFile("ExampleController.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Http" + File.separator + "Controllers" + File.separator, "ExampleController.php"));
|
||||
supportingFiles.add(new SupportingFile("Authenticate.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "Authenticate.php"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("ExampleMiddleware.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Http" + File.separator + "Middleware" + File.separator, "ExampleMiddleware.php"));
|
||||
supportingFiles.add(new SupportingFile("ExampleJob.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Jobs", "ExampleJob.php"));
|
||||
supportingFiles.add(new SupportingFile("Job.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Jobs", "Job.php"));
|
||||
supportingFiles.add(new SupportingFile("ExampleListener.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Listeners", "ExampleListener.php"));
|
||||
supportingFiles.add(new SupportingFile("AppServiceProvider.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Providers", "AppServiceProvider.php"));
|
||||
supportingFiles.add(new SupportingFile("AuthServiceProvider.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Providers", "AuthServiceProvider.php"));
|
||||
supportingFiles.add(new SupportingFile("EventServiceProvider.php", packagePath + File.separator + srcBasePath + File.separator + "app" + File.separator + "Providers", "EventServiceProvider.php"));
|
||||
supportingFiles.add(new SupportingFile("app.php", packagePath + File.separator + srcBasePath + File.separator + "bootstrap", "app.php"));
|
||||
supportingFiles.add(new SupportingFile("ModelFactory.php", packagePath + File.separator + srcBasePath + File.separator + "database" + File.separator + "factories", "ModelFactory.php"));
|
||||
supportingFiles.add(new SupportingFile(".gitkeep", packagePath + File.separator + srcBasePath + File.separator + "database" + File.separator + "migrations", ".gitkeep"));
|
||||
supportingFiles.add(new SupportingFile("DatabaseSeeder.php", packagePath + File.separator + srcBasePath + File.separator + "database" + File.separator + "seeds", "DatabaseSeeder.php"));
|
||||
supportingFiles.add(new SupportingFile(".htaccess", packagePath + File.separator + srcBasePath + File.separator + "public", ".htaccess"));
|
||||
supportingFiles.add(new SupportingFile("index.php", packagePath + File.separator + srcBasePath + File.separator + "public", "index.php"));
|
||||
supportingFiles.add(new SupportingFile(".gitkeep", packagePath + File.separator + srcBasePath + File.separator + "resources" + File.separator + "views", ".gitkeep"));
|
||||
supportingFiles.add(new SupportingFile("routes.mustache", packagePath + File.separator + srcBasePath + File.separator + "routes", "web.php"));
|
||||
supportingFiles.add(new SupportingFile("ExampleTest.php", packagePath + File.separator + srcBasePath + File.separator + "tests", "ExampleTest.php"));
|
||||
supportingFiles.add(new SupportingFile("TestCase.php", packagePath + File.separator + srcBasePath + File.separator + "tests", "TestCase.php"));
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
|
@ -0,0 +1,17 @@
|
||||
APP_ENV=local
|
||||
APP_DEBUG=true
|
||||
APP_KEY=
|
||||
APP_TIMEZONE=UTC
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_SLACK_WEBHOOK_URL=
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=homestead
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_DRIVER=sync
|
21
modules/openapi-generator/src/main/resources/lumen/.htaccess
Normal file
21
modules/openapi-generator/src/main/resources/lumen/.htaccess
Normal file
@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the authentication services for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Here you may define how you wish users to be authenticated for your Lumen
|
||||
// application. The callback which receives the incoming request instance
|
||||
// should return either a User instance or null. You're free to obtain
|
||||
// the User instance via an API token or any other method necessary.
|
||||
|
||||
$this->app['auth']->viaRequest('api', function ($request) {
|
||||
if ($request->input('api_token')) {
|
||||
return User::where('api_token', $request->input('api_token'))->first();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
/*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call('UsersTableSeeder');
|
||||
}
|
||||
}
|
10
modules/openapi-generator/src/main/resources/lumen/Event.php
Normal file
10
modules/openapi-generator/src/main/resources/lumen/Event.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
use SerializesModels;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\ExampleEvent' => [
|
||||
'App\Listeners\ExampleListener',
|
||||
],
|
||||
];
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
class ExampleEvent extends Event
|
||||
{
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
class ExampleJob extends Job
|
||||
{
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ExampleEvent;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class ExampleListener
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param ExampleEvent $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ExampleEvent $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class ExampleMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$this->get('/');
|
||||
|
||||
$this->assertEquals(
|
||||
$this->app->version(), $this->response->getContent()
|
||||
);
|
||||
}
|
||||
}
|
24
modules/openapi-generator/src/main/resources/lumen/Job.php
Normal file
24
modules/openapi-generator/src/main/resources/lumen/Job.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
abstract class Job implements ShouldQueue
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queueable Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This job base class provides a central location to place any logic that
|
||||
| is shared across all of your jobs. The trait included with the class
|
||||
| provides access to the "queueOn" and "delay" queue helper methods.
|
||||
|
|
||||
*/
|
||||
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->email,
|
||||
];
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
abstract class TestCase extends Laravel\Lumen\Testing\TestCase
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Laravel\Lumen\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
return require __DIR__.'/../bootstrap/app.php';
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ $app = new Laravel\Lumen\Application(
|
||||
realpath(__DIR__.'/../')
|
||||
);
|
||||
|
||||
$app->withFacades();
|
||||
// $app->withFacades();
|
||||
|
||||
// $app->withEloquent();
|
||||
|
||||
@ -99,8 +99,12 @@ $app->singleton(
|
||||
|
|
||||
*/
|
||||
|
||||
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
||||
require __DIR__.'/../app/Http/routes.php';
|
||||
$app->router->group([
|
||||
'namespace' => 'App\Http\Controllers',
|
||||
], function ($router) {
|
||||
require __DIR__.'/../routes/web.php';
|
||||
});
|
||||
|
||||
$app->withFacades();
|
||||
|
||||
return $app;
|
||||
|
@ -5,6 +5,9 @@
|
||||
{{/artifactVersion}}
|
||||
"description": "{{description}}",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
"lumen",
|
||||
"openapi",
|
||||
"openapitools",
|
||||
"php",
|
||||
@ -19,14 +22,38 @@
|
||||
"homepage": "https://openapi-generator.tech"
|
||||
}
|
||||
],
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"laravel/lumen-framework": "5.2.*",
|
||||
"php": ">=7.1.3",
|
||||
"laravel/lumen-framework": "5.6.*",
|
||||
"vlucas/phpdotenv": "~2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"phpunit/phpunit": "~7.0",
|
||||
"mockery/mockery": "~1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/",
|
||||
"database/"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="bootstrap/app.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false">
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./app</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
</php>
|
||||
</phpunit>
|
@ -12,5 +12,11 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how
|
||||
## Installation & Usage
|
||||
### Composer
|
||||
|
||||
Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/).
|
||||
Switch to the generated Lumen server stub directory.
|
||||
Using `composer update` to install the framework and dependencies via [Composer](http://getcomposer.org/).
|
||||
|
||||
## Note
|
||||
|
||||
The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after excuting `composer update`.
|
||||
Or there would be errors during service or model migration.
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
* @version {{appVersion}}
|
||||
*/
|
||||
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app->version();
|
||||
$router->get('/', function () use ($router) {
|
||||
return $router->app->version();
|
||||
});
|
||||
|
||||
{{#apis}}
|
||||
@ -17,9 +17,8 @@ $app->get('/', function () use ($app) {
|
||||
* {{httpMethod}} {{operationId}}
|
||||
* Summary: {{summary}}
|
||||
* Notes: {{notes}}
|
||||
{{#hasProduces}} * Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}}
|
||||
*/
|
||||
$app->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', '{{classname}}@{{operationId}}');
|
||||
$router->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', '{{classname}}@{{operationId}}');
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
|
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
17
samples/server/petstore/php-lumen/lib/.env.example
Normal file
17
samples/server/petstore/php-lumen/lib/.env.example
Normal file
@ -0,0 +1,17 @@
|
||||
APP_ENV=local
|
||||
APP_DEBUG=true
|
||||
APP_KEY=
|
||||
APP_TIMEZONE=UTC
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_SLACK_WEBHOOK_URL=
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=homestead
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_DRIVER=sync
|
10
samples/server/petstore/php-lumen/lib/app/Events/Event.php
Normal file
10
samples/server/petstore/php-lumen/lib/app/Events/Event.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
use SerializesModels;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
class ExampleEvent extends Event
|
||||
{
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
/*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class ExampleMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
class ExampleJob extends Job
|
||||
{
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
24
samples/server/petstore/php-lumen/lib/app/Jobs/Job.php
Normal file
24
samples/server/petstore/php-lumen/lib/app/Jobs/Job.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
abstract class Job implements ShouldQueue
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queueable Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This job base class provides a central location to place any logic that
|
||||
| is shared across all of your jobs. The trait included with the class
|
||||
| provides access to the "queueOn" and "delay" queue helper methods.
|
||||
|
|
||||
*/
|
||||
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ExampleEvent;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class ExampleListener
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param ExampleEvent $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ExampleEvent $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the authentication services for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Here you may define how you wish users to be authenticated for your Lumen
|
||||
// application. The callback which receives the incoming request instance
|
||||
// should return either a User instance or null. You're free to obtain
|
||||
// the User instance via an API token or any other method necessary.
|
||||
|
||||
$this->app['auth']->viaRequest('api', function ($request) {
|
||||
if ($request->input('api_token')) {
|
||||
return User::where('api_token', $request->input('api_token'))->first();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\ExampleEvent' => [
|
||||
'App\Listeners\ExampleListener',
|
||||
],
|
||||
];
|
||||
}
|
35
samples/server/petstore/php-lumen/lib/artisan
Normal file
35
samples/server/petstore/php-lumen/lib/artisan
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| First we need to get an application instance. This creates an instance
|
||||
| of the application / container and bootstraps the application so it
|
||||
| is ready to receive HTTP / Console requests from the environment.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(
|
||||
'Illuminate\Contracts\Console\Kernel'
|
||||
);
|
||||
|
||||
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
|
@ -29,7 +29,7 @@ $app = new Laravel\Lumen\Application(
|
||||
realpath(__DIR__.'/../')
|
||||
);
|
||||
|
||||
$app->withFacades();
|
||||
// $app->withFacades();
|
||||
|
||||
// $app->withEloquent();
|
||||
|
||||
@ -99,8 +99,12 @@ $app->singleton(
|
||||
|
|
||||
*/
|
||||
|
||||
$app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
|
||||
require __DIR__.'/../app/Http/routes.php';
|
||||
$app->router->group([
|
||||
'namespace' => 'App\Http\Controllers',
|
||||
], function ($router) {
|
||||
require __DIR__.'/../routes/web.php';
|
||||
});
|
||||
|
||||
$app->withFacades();
|
||||
|
||||
return $app;
|
||||
|
@ -2,6 +2,9 @@
|
||||
"name": "GIT_USER_ID/GIT_REPO_ID",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
"lumen",
|
||||
"openapi",
|
||||
"openapitools",
|
||||
"php",
|
||||
@ -16,14 +19,38 @@
|
||||
"homepage": "https://openapi-generator.tech"
|
||||
}
|
||||
],
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"laravel/lumen-framework": "5.2.*",
|
||||
"php": ">=7.1.3",
|
||||
"laravel/lumen-framework": "5.6.*",
|
||||
"vlucas/phpdotenv": "~2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"phpunit/phpunit": "~7.0",
|
||||
"mockery/mockery": "~1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/",
|
||||
"database/"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->email,
|
||||
];
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call('UsersTableSeeder');
|
||||
}
|
||||
}
|
21
samples/server/petstore/php-lumen/lib/public/.htaccess
Normal file
21
samples/server/petstore/php-lumen/lib/public/.htaccess
Normal file
@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
@ -12,5 +12,11 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how
|
||||
## Installation & Usage
|
||||
### Composer
|
||||
|
||||
Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/).
|
||||
Switch to the generated Lumen server stub directory.
|
||||
Using `composer update` to install the framework and dependencies via [Composer](http://getcomposer.org/).
|
||||
|
||||
## Note
|
||||
|
||||
The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after excuting `composer update`.
|
||||
Or there would be errors during service or model migration.
|
||||
|
||||
|
@ -17,232 +17,200 @@
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app->version();
|
||||
$router->get('/', function () use ($router) {
|
||||
return $router->app->version();
|
||||
});
|
||||
|
||||
/**
|
||||
* patch testSpecialTags
|
||||
* Summary: To test special tags
|
||||
* Notes: To test special tags
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->patch('/v2/another-fake/dummy', 'AnotherFakeApi@testSpecialTags');
|
||||
$router->patch('/v2/another-fake/dummy', 'AnotherFakeApi@testSpecialTags');
|
||||
/**
|
||||
* patch testClientModel
|
||||
* Summary: To test \"client\" model
|
||||
* Notes: To test \"client\" model
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->patch('/v2/fake', 'FakeApi@testClientModel');
|
||||
$router->patch('/v2/fake', 'FakeApi@testClientModel');
|
||||
/**
|
||||
* post testEndpointParameters
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
*/
|
||||
$app->post('/v2/fake', 'FakeApi@testEndpointParameters');
|
||||
$router->post('/v2/fake', 'FakeApi@testEndpointParameters');
|
||||
/**
|
||||
* get testEnumParameters
|
||||
* Summary: To test enum parameters
|
||||
* Notes: To test enum parameters
|
||||
|
||||
*/
|
||||
$app->get('/v2/fake', 'FakeApi@testEnumParameters');
|
||||
$router->get('/v2/fake', 'FakeApi@testEnumParameters');
|
||||
/**
|
||||
* put testBodyWithQueryParams
|
||||
* Summary:
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->put('/v2/fake/body-with-query-params', 'FakeApi@testBodyWithQueryParams');
|
||||
$router->put('/v2/fake/body-with-query-params', 'FakeApi@testBodyWithQueryParams');
|
||||
/**
|
||||
* post testInlineAdditionalProperties
|
||||
* Summary: test inline additionalProperties
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->post('/v2/fake/inline-additionalProperties', 'FakeApi@testInlineAdditionalProperties');
|
||||
$router->post('/v2/fake/inline-additionalProperties', 'FakeApi@testInlineAdditionalProperties');
|
||||
/**
|
||||
* get testJsonFormData
|
||||
* Summary: test json serialization of form data
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->get('/v2/fake/jsonFormData', 'FakeApi@testJsonFormData');
|
||||
$router->get('/v2/fake/jsonFormData', 'FakeApi@testJsonFormData');
|
||||
/**
|
||||
* post fakeOuterBooleanSerialize
|
||||
* Summary:
|
||||
* Notes: Test serialization of outer boolean types
|
||||
* Output-Formats: [*/*]
|
||||
*/
|
||||
$app->post('/v2/fake/outer/boolean', 'FakeApi@fakeOuterBooleanSerialize');
|
||||
$router->post('/v2/fake/outer/boolean', 'FakeApi@fakeOuterBooleanSerialize');
|
||||
/**
|
||||
* post fakeOuterCompositeSerialize
|
||||
* Summary:
|
||||
* Notes: Test serialization of object with outer number type
|
||||
* Output-Formats: [*/*]
|
||||
*/
|
||||
$app->post('/v2/fake/outer/composite', 'FakeApi@fakeOuterCompositeSerialize');
|
||||
$router->post('/v2/fake/outer/composite', 'FakeApi@fakeOuterCompositeSerialize');
|
||||
/**
|
||||
* post fakeOuterNumberSerialize
|
||||
* Summary:
|
||||
* Notes: Test serialization of outer number types
|
||||
* Output-Formats: [*/*]
|
||||
*/
|
||||
$app->post('/v2/fake/outer/number', 'FakeApi@fakeOuterNumberSerialize');
|
||||
$router->post('/v2/fake/outer/number', 'FakeApi@fakeOuterNumberSerialize');
|
||||
/**
|
||||
* post fakeOuterStringSerialize
|
||||
* Summary:
|
||||
* Notes: Test serialization of outer string types
|
||||
* Output-Formats: [*/*]
|
||||
*/
|
||||
$app->post('/v2/fake/outer/string', 'FakeApi@fakeOuterStringSerialize');
|
||||
$router->post('/v2/fake/outer/string', 'FakeApi@fakeOuterStringSerialize');
|
||||
/**
|
||||
* patch testClassname
|
||||
* Summary: To test class name in snake case
|
||||
* Notes: To test class name in snake case
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->patch('/v2/fake_classname_test', 'FakeClassnameTags123Api@testClassname');
|
||||
$router->patch('/v2/fake_classname_test', 'FakeClassnameTags123Api@testClassname');
|
||||
/**
|
||||
* post addPet
|
||||
* Summary: Add a new pet to the store
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->post('/v2/pet', 'PetApi@addPet');
|
||||
$router->post('/v2/pet', 'PetApi@addPet');
|
||||
/**
|
||||
* put updatePet
|
||||
* Summary: Update an existing pet
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->put('/v2/pet', 'PetApi@updatePet');
|
||||
$router->put('/v2/pet', 'PetApi@updatePet');
|
||||
/**
|
||||
* get findPetsByStatus
|
||||
* Summary: Finds Pets by status
|
||||
* Notes: Multiple status values can be provided with comma separated strings
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/pet/findByStatus', 'PetApi@findPetsByStatus');
|
||||
$router->get('/v2/pet/findByStatus', 'PetApi@findPetsByStatus');
|
||||
/**
|
||||
* get findPetsByTags
|
||||
* Summary: Finds Pets by tags
|
||||
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/pet/findByTags', 'PetApi@findPetsByTags');
|
||||
$router->get('/v2/pet/findByTags', 'PetApi@findPetsByTags');
|
||||
/**
|
||||
* delete deletePet
|
||||
* Summary: Deletes a pet
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->delete('/v2/pet/{petId}', 'PetApi@deletePet');
|
||||
$router->delete('/v2/pet/{petId}', 'PetApi@deletePet');
|
||||
/**
|
||||
* get getPetById
|
||||
* Summary: Find pet by ID
|
||||
* Notes: Returns a single pet
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/pet/{petId}', 'PetApi@getPetById');
|
||||
$router->get('/v2/pet/{petId}', 'PetApi@getPetById');
|
||||
/**
|
||||
* post updatePetWithForm
|
||||
* Summary: Updates a pet in the store with form data
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->post('/v2/pet/{petId}', 'PetApi@updatePetWithForm');
|
||||
$router->post('/v2/pet/{petId}', 'PetApi@updatePetWithForm');
|
||||
/**
|
||||
* post uploadFile
|
||||
* Summary: uploads an image
|
||||
* Notes:
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->post('/v2/pet/{petId}/uploadImage', 'PetApi@uploadFile');
|
||||
$router->post('/v2/pet/{petId}/uploadImage', 'PetApi@uploadFile');
|
||||
/**
|
||||
* get getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
* Notes: Returns a map of status codes to quantities
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->get('/v2/store/inventory', 'StoreApi@getInventory');
|
||||
$router->get('/v2/store/inventory', 'StoreApi@getInventory');
|
||||
/**
|
||||
* post placeOrder
|
||||
* Summary: Place an order for a pet
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->post('/v2/store/order', 'StoreApi@placeOrder');
|
||||
$router->post('/v2/store/order', 'StoreApi@placeOrder');
|
||||
/**
|
||||
* delete deleteOrder
|
||||
* Summary: Delete purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
*/
|
||||
$app->delete('/v2/store/order/{order_id}', 'StoreApi@deleteOrder');
|
||||
$router->delete('/v2/store/order/{order_id}', 'StoreApi@deleteOrder');
|
||||
/**
|
||||
* get getOrderById
|
||||
* Summary: Find purchase order by ID
|
||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/store/order/{order_id}', 'StoreApi@getOrderById');
|
||||
$router->get('/v2/store/order/{order_id}', 'StoreApi@getOrderById');
|
||||
/**
|
||||
* post createUser
|
||||
* Summary: Create user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
|
||||
*/
|
||||
$app->post('/v2/user', 'UserApi@createUser');
|
||||
$router->post('/v2/user', 'UserApi@createUser');
|
||||
/**
|
||||
* post createUsersWithArrayInput
|
||||
* Summary: Creates list of users with given input array
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->post('/v2/user/createWithArray', 'UserApi@createUsersWithArrayInput');
|
||||
$router->post('/v2/user/createWithArray', 'UserApi@createUsersWithArrayInput');
|
||||
/**
|
||||
* post createUsersWithListInput
|
||||
* Summary: Creates list of users with given input array
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->post('/v2/user/createWithList', 'UserApi@createUsersWithListInput');
|
||||
$router->post('/v2/user/createWithList', 'UserApi@createUsersWithListInput');
|
||||
/**
|
||||
* get loginUser
|
||||
* Summary: Logs user into the system
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/user/login', 'UserApi@loginUser');
|
||||
$router->get('/v2/user/login', 'UserApi@loginUser');
|
||||
/**
|
||||
* get logoutUser
|
||||
* Summary: Logs out current logged in user session
|
||||
* Notes:
|
||||
|
||||
*/
|
||||
$app->get('/v2/user/logout', 'UserApi@logoutUser');
|
||||
$router->get('/v2/user/logout', 'UserApi@logoutUser');
|
||||
/**
|
||||
* delete deleteUser
|
||||
* Summary: Delete user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
|
||||
*/
|
||||
$app->delete('/v2/user/{username}', 'UserApi@deleteUser');
|
||||
$router->delete('/v2/user/{username}', 'UserApi@deleteUser');
|
||||
/**
|
||||
* get getUserByName
|
||||
* Summary: Get user by user name
|
||||
* Notes:
|
||||
* Output-Formats: [application/xml, application/json]
|
||||
*/
|
||||
$app->get('/v2/user/{username}', 'UserApi@getUserByName');
|
||||
$router->get('/v2/user/{username}', 'UserApi@getUserByName');
|
||||
/**
|
||||
* put updateUser
|
||||
* Summary: Updated user
|
||||
* Notes: This can only be done by the logged in user.
|
||||
|
||||
*/
|
||||
$app->put('/v2/user/{username}', 'UserApi@updateUser');
|
||||
$router->put('/v2/user/{username}', 'UserApi@updateUser');
|
||||
|
2
samples/server/petstore/php-lumen/lib/storage/logs/.gitignore
vendored
Normal file
2
samples/server/petstore/php-lumen/lib/storage/logs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
21
samples/server/petstore/php-lumen/lib/tests/ExampleTest.php
Normal file
21
samples/server/petstore/php-lumen/lib/tests/ExampleTest.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$this->get('/');
|
||||
|
||||
$this->assertEquals(
|
||||
$this->app->version(), $this->response->getContent()
|
||||
);
|
||||
}
|
||||
}
|
14
samples/server/petstore/php-lumen/lib/tests/TestCase.php
Normal file
14
samples/server/petstore/php-lumen/lib/tests/TestCase.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
abstract class TestCase extends Laravel\Lumen\Testing\TestCase
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Laravel\Lumen\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
return require __DIR__.'/../bootstrap/app.php';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user