Просмотр исходного кода

[Laravel][Lumen] Fix swoole pbs (#6095)

* update laravel-swoole in composer.json

* fix version

* remove handle_static_files option for laravel

* remove public_path

* remove ob_output

* Fix for Lumen

* try with where->first

* remove unused files

* remove unused providers

* remove config files

* remove unused files

* Update Controller.php

* remove unused Lumen files

* rename README files
J-C HERON 4 лет назад
Родитель
Сommit
fb56253d14
51 измененных файлов с 128 добавлено и 1677 удалено
  1. 0 0
      frameworks/PHP/laravel/README.md
  2. 0 32
      frameworks/PHP/laravel/app/Http/Controllers/Auth/ForgotPasswordController.php
  3. 0 39
      frameworks/PHP/laravel/app/Http/Controllers/Auth/LoginController.php
  4. 0 72
      frameworks/PHP/laravel/app/Http/Controllers/Auth/RegisterController.php
  5. 0 39
      frameworks/PHP/laravel/app/Http/Controllers/Auth/ResetPasswordController.php
  6. 6 2
      frameworks/PHP/laravel/app/Http/Controllers/Controller.php
  7. 48 53
      frameworks/PHP/laravel/app/Http/Kernel.php
  8. 0 17
      frameworks/PHP/laravel/app/Http/Middleware/EncryptCookies.php
  9. 0 26
      frameworks/PHP/laravel/app/Http/Middleware/RedirectIfAuthenticated.php
  10. 0 18
      frameworks/PHP/laravel/app/Http/Middleware/TrimStrings.php
  11. 0 23
      frameworks/PHP/laravel/app/Http/Middleware/TrustProxies.php
  12. 0 17
      frameworks/PHP/laravel/app/Http/Middleware/VerifyCsrfToken.php
  13. 0 30
      frameworks/PHP/laravel/app/Providers/AuthServiceProvider.php
  14. 0 21
      frameworks/PHP/laravel/app/Providers/BroadcastServiceProvider.php
  15. 0 32
      frameworks/PHP/laravel/app/Providers/EventServiceProvider.php
  16. 0 29
      frameworks/PHP/laravel/app/User.php
  17. 0 102
      frameworks/PHP/laravel/config/auth.php
  18. 0 59
      frameworks/PHP/laravel/config/broadcasting.php
  19. 0 69
      frameworks/PHP/laravel/config/filesystems.php
  20. 0 20
      frameworks/PHP/laravel/config/hashing.php
  21. 0 70
      frameworks/PHP/laravel/config/logging.php
  22. 0 123
      frameworks/PHP/laravel/config/mail.php
  23. 0 38
      frameworks/PHP/laravel/config/services.php
  24. 0 197
      frameworks/PHP/laravel/config/session.php
  25. 36 38
      frameworks/PHP/laravel/config/swoole_http.php
  26. 1 1
      frameworks/PHP/laravel/deploy/swoole/composer.json
  27. 0 31
      frameworks/PHP/laravel/phpunit.xml
  28. 0 21
      frameworks/PHP/laravel/public/.htaccess
  29. 0 2
      frameworks/PHP/laravel/public/robots.txt
  30. 0 25
      frameworks/PHP/laravel/tests/CreatesApplication.php
  31. 0 21
      frameworks/PHP/laravel/tests/Feature/ExampleTest.php
  32. 0 10
      frameworks/PHP/laravel/tests/TestCase.php
  33. 0 19
      frameworks/PHP/laravel/tests/Unit/ExampleTest.php
  34. 0 0
      frameworks/PHP/lumen/README.md
  35. 0 10
      frameworks/PHP/lumen/app/Events/Event.php
  36. 0 16
      frameworks/PHP/lumen/app/Events/ExampleEvent.php
  37. 0 44
      frameworks/PHP/lumen/app/Http/Middleware/Authenticate.php
  38. 0 20
      frameworks/PHP/lumen/app/Http/Middleware/ExampleMiddleware.php
  39. 0 26
      frameworks/PHP/lumen/app/Jobs/ExampleJob.php
  40. 0 24
      frameworks/PHP/lumen/app/Jobs/Job.php
  41. 0 31
      frameworks/PHP/lumen/app/Listeners/ExampleListener.php
  42. 2 3
      frameworks/PHP/lumen/app/Models/Fortune.php
  43. 0 18
      frameworks/PHP/lumen/app/Providers/AppServiceProvider.php
  44. 0 39
      frameworks/PHP/lumen/app/Providers/AuthServiceProvider.php
  45. 0 19
      frameworks/PHP/lumen/app/Providers/EventServiceProvider.php
  46. 0 32
      frameworks/PHP/lumen/app/User.php
  47. 34 36
      frameworks/PHP/lumen/config/swoole_http.php
  48. 1 1
      frameworks/PHP/lumen/deploy/swoole/composer.json
  49. 0 27
      frameworks/PHP/lumen/phpunit.xml
  50. 0 21
      frameworks/PHP/lumen/tests/ExampleTest.php
  51. 0 14
      frameworks/PHP/lumen/tests/TestCase.php

+ 0 - 0
frameworks/PHP/laravel/readme.md → frameworks/PHP/laravel/README.md


+ 0 - 32
frameworks/PHP/laravel/app/Http/Controllers/Auth/ForgotPasswordController.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
-
-class ForgotPasswordController extends Controller
-{
-    /*
-    |--------------------------------------------------------------------------
-    | Password Reset Controller
-    |--------------------------------------------------------------------------
-    |
-    | This controller is responsible for handling password reset emails and
-    | includes a trait which assists in sending these notifications from
-    | your application to your users. Feel free to explore this trait.
-    |
-    */
-
-    use SendsPasswordResetEmails;
-
-    /**
-     * Create a new controller instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        $this->middleware('guest');
-    }
-}

+ 0 - 39
frameworks/PHP/laravel/app/Http/Controllers/Auth/LoginController.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\AuthenticatesUsers;
-
-class LoginController extends Controller
-{
-    /*
-    |--------------------------------------------------------------------------
-    | Login Controller
-    |--------------------------------------------------------------------------
-    |
-    | This controller handles authenticating users for the application and
-    | redirecting them to your home screen. The controller uses a trait
-    | to conveniently provide its functionality to your applications.
-    |
-    */
-
-    use AuthenticatesUsers;
-
-    /**
-     * Where to redirect users after login.
-     *
-     * @var string
-     */
-    protected $redirectTo = '/home';
-
-    /**
-     * Create a new controller instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        $this->middleware('guest')->except('logout');
-    }
-}

+ 0 - 72
frameworks/PHP/laravel/app/Http/Controllers/Auth/RegisterController.php

@@ -1,72 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\User;
-use App\Http\Controllers\Controller;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Validator;
-use Illuminate\Foundation\Auth\RegistersUsers;
-
-class RegisterController extends Controller
-{
-    /*
-    |--------------------------------------------------------------------------
-    | Register Controller
-    |--------------------------------------------------------------------------
-    |
-    | This controller handles the registration of new users as well as their
-    | validation and creation. By default this controller uses a trait to
-    | provide this functionality without requiring any additional code.
-    |
-    */
-
-    use RegistersUsers;
-
-    /**
-     * Where to redirect users after registration.
-     *
-     * @var string
-     */
-    protected $redirectTo = '/home';
-
-    /**
-     * Create a new controller instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        $this->middleware('guest');
-    }
-
-    /**
-     * Get a validator for an incoming registration request.
-     *
-     * @param  array  $data
-     * @return \Illuminate\Contracts\Validation\Validator
-     */
-    protected function validator(array $data)
-    {
-        return Validator::make($data, [
-            'name' => 'required|string|max:255',
-            'email' => 'required|string|email|max:255|unique:users',
-            'password' => 'required|string|min:6|confirmed',
-        ]);
-    }
-
-    /**
-     * Create a new user instance after a valid registration.
-     *
-     * @param  array  $data
-     * @return \App\User
-     */
-    protected function create(array $data)
-    {
-        return User::create([
-            'name' => $data['name'],
-            'email' => $data['email'],
-            'password' => Hash::make($data['password']),
-        ]);
-    }
-}

+ 0 - 39
frameworks/PHP/laravel/app/Http/Controllers/Auth/ResetPasswordController.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\ResetsPasswords;
-
-class ResetPasswordController extends Controller
-{
-    /*
-    |--------------------------------------------------------------------------
-    | Password Reset Controller
-    |--------------------------------------------------------------------------
-    |
-    | This controller is responsible for handling password reset requests
-    | and uses a simple trait to include this behavior. You're free to
-    | explore this trait and override any methods you wish to tweak.
-    |
-    */
-
-    use ResetsPasswords;
-
-    /**
-     * Where to redirect users after resetting their password.
-     *
-     * @var string
-     */
-    protected $redirectTo = '/home';
-
-    /**
-     * Create a new controller instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        $this->middleware('guest');
-    }
-}

+ 6 - 2
frameworks/PHP/laravel/app/Http/Controllers/Controller.php

@@ -14,7 +14,7 @@ class Controller extends BaseController {
 	}
 
 	public function db() {
-		return World::find(\mt_rand(1, 10000));
+		return World::where('id', \mt_rand(1, 10000))->first(); // to compare with find()
 	}
 
 	public function queries($queries = 1) {
@@ -54,7 +54,11 @@ class Controller extends BaseController {
 			} while ($oldId === $newId);
 			$row->randomNumber = $newId;
 			do {
-				$saved = $row->save();
+				try {
+					$saved = $row->save();
+				} catch (\Exception $e) {
+					$saved = false;
+				}
 			} while (! $saved);
 			$rows[] = $row;
 		}

+ 48 - 53
frameworks/PHP/laravel/app/Http/Kernel.php

@@ -1,62 +1,57 @@
 <?php
-
 namespace App\Http;
 
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
 
-class Kernel extends HttpKernel
-{
-    /**
-     * The application's global HTTP middleware stack.
-     *
-     * These middleware are run during every request to your application.
-     *
-     * @var array
-     */
-    protected $middleware = [
-//        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
-//        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
-//        \App\Http\Middleware\TrimStrings::class,
-//        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
-//        \App\Http\Middleware\TrustProxies::class,
-    ];
+class Kernel extends HttpKernel {
+
+	/**
+	 * The application's global HTTP middleware stack.
+	 *
+	 * These middleware are run during every request to your application.
+	 *
+	 * @var array
+	 */
+	protected $middleware = [ // \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
+	// \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
+	// \App\Http\Middleware\TrimStrings::class,
+	// \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
+	// \App\Http\Middleware\TrustProxies::class,
+	];
 
-    /**
-     * The application's route middleware groups.
-     *
-     * @var array
-     */
-    protected $middlewareGroups = [
-        'web' => [
-//            \App\Http\Middleware\EncryptCookies::class,
-//            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
-//            \Illuminate\Session\Middleware\StartSession::class,
-//            // \Illuminate\Session\Middleware\AuthenticateSession::class,
-//            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
-//            \App\Http\Middleware\VerifyCsrfToken::class,
-//            \Illuminate\Routing\Middleware\SubstituteBindings::class,
-        ],
+	/**
+	 * The application's route middleware groups.
+	 *
+	 * @var array
+	 */
+	protected $middlewareGroups = [
+		'web' => [ // \App\Http\Middleware\EncryptCookies::class,
+		// \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
+		// \Illuminate\Session\Middleware\StartSession::class,
+		// // \Illuminate\Session\Middleware\AuthenticateSession::class,
+		// \Illuminate\View\Middleware\ShareErrorsFromSession::class,
+		// \App\Http\Middleware\VerifyCsrfToken::class,
+		// \Illuminate\Routing\Middleware\SubstituteBindings::class,
+		],
 
-        'api' => [
-            'throttle:60,1',
-            'bindings',
-        ],
-    ];
+		'api' => [ // 'throttle:60,1',
+		// 'bindings',
+		]
+	];
 
-    /**
-     * The application's route middleware.
-     *
-     * These middleware may be assigned to groups or used individually.
-     *
-     * @var array
-     */
-    protected $routeMiddleware = [
-//        'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
-//        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
-//        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
-//        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
-//        'can' => \Illuminate\Auth\Middleware\Authorize::class,
-//        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
-//        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
-    ];
+	/**
+	 * The application's route middleware.
+	 *
+	 * These middleware may be assigned to groups or used individually.
+	 *
+	 * @var array
+	 */
+	protected $routeMiddleware = [ // 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
+	// 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
+	// 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
+	// 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
+	// 'can' => \Illuminate\Auth\Middleware\Authorize::class,
+	// 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
+	// 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+	];
 }

+ 0 - 17
frameworks/PHP/laravel/app/Http/Middleware/EncryptCookies.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
-
-class EncryptCookies extends Middleware
-{
-    /**
-     * The names of the cookies that should not be encrypted.
-     *
-     * @var array
-     */
-    protected $except = [
-        //
-    ];
-}

+ 0 - 26
frameworks/PHP/laravel/app/Http/Middleware/RedirectIfAuthenticated.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Closure;
-use Illuminate\Support\Facades\Auth;
-
-class RedirectIfAuthenticated
-{
-    /**
-     * Handle an incoming request.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Closure  $next
-     * @param  string|null  $guard
-     * @return mixed
-     */
-    public function handle($request, Closure $next, $guard = null)
-    {
-        if (Auth::guard($guard)->check()) {
-            return redirect('/home');
-        }
-
-        return $next($request);
-    }
-}

+ 0 - 18
frameworks/PHP/laravel/app/Http/Middleware/TrimStrings.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
-
-class TrimStrings extends Middleware
-{
-    /**
-     * The names of the attributes that should not be trimmed.
-     *
-     * @var array
-     */
-    protected $except = [
-        'password',
-        'password_confirmation',
-    ];
-}

+ 0 - 23
frameworks/PHP/laravel/app/Http/Middleware/TrustProxies.php

@@ -1,23 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Illuminate\Http\Request;
-use Fideloper\Proxy\TrustProxies as Middleware;
-
-class TrustProxies extends Middleware
-{
-    /**
-     * The trusted proxies for this application.
-     *
-     * @var array
-     */
-    protected $proxies;
-
-    /**
-     * The headers that should be used to detect proxies.
-     *
-     * @var string
-     */
-    protected $headers = Request::HEADER_X_FORWARDED_ALL;
-}

+ 0 - 17
frameworks/PHP/laravel/app/Http/Middleware/VerifyCsrfToken.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
-
-class VerifyCsrfToken extends Middleware
-{
-    /**
-     * The URIs that should be excluded from CSRF verification.
-     *
-     * @var array
-     */
-    protected $except = [
-        //
-    ];
-}

+ 0 - 30
frameworks/PHP/laravel/app/Providers/AuthServiceProvider.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App\Providers;
-
-use Illuminate\Support\Facades\Gate;
-use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
-
-class AuthServiceProvider extends ServiceProvider
-{
-    /**
-     * The policy mappings for the application.
-     *
-     * @var array
-     */
-    protected $policies = [
-        'App\Model' => 'App\Policies\ModelPolicy',
-    ];
-
-    /**
-     * Register any authentication / authorization services.
-     *
-     * @return void
-     */
-    public function boot()
-    {
-        $this->registerPolicies();
-
-        //
-    }
-}

+ 0 - 21
frameworks/PHP/laravel/app/Providers/BroadcastServiceProvider.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Providers;
-
-use Illuminate\Support\ServiceProvider;
-use Illuminate\Support\Facades\Broadcast;
-
-class BroadcastServiceProvider extends ServiceProvider
-{
-    /**
-     * Bootstrap any application services.
-     *
-     * @return void
-     */
-    public function boot()
-    {
-        Broadcast::routes();
-
-        require base_path('routes/channels.php');
-    }
-}

+ 0 - 32
frameworks/PHP/laravel/app/Providers/EventServiceProvider.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Providers;
-
-use Illuminate\Support\Facades\Event;
-use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
-
-class EventServiceProvider extends ServiceProvider
-{
-    /**
-     * The event listener mappings for the application.
-     *
-     * @var array
-     */
-    protected $listen = [
-        'App\Events\Event' => [
-            'App\Listeners\EventListener',
-        ],
-    ];
-
-    /**
-     * Register any events for your application.
-     *
-     * @return void
-     */
-    public function boot()
-    {
-        parent::boot();
-
-        //
-    }
-}

+ 0 - 29
frameworks/PHP/laravel/app/User.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App;
-
-use Illuminate\Notifications\Notifiable;
-use Illuminate\Foundation\Auth\User as Authenticatable;
-
-class User extends Authenticatable
-{
-    use Notifiable;
-
-    /**
-     * The attributes that are mass assignable.
-     *
-     * @var array
-     */
-    protected $fillable = [
-        'name', 'email', 'password',
-    ];
-
-    /**
-     * The attributes that should be hidden for arrays.
-     *
-     * @var array
-     */
-    protected $hidden = [
-        'password', 'remember_token',
-    ];
-}

+ 0 - 102
frameworks/PHP/laravel/config/auth.php

@@ -1,102 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Authentication Defaults
-    |--------------------------------------------------------------------------
-    |
-    | This option controls the default authentication "guard" and password
-    | reset options for your application. You may change these defaults
-    | as required, but they're a perfect start for most applications.
-    |
-    */
-
-    'defaults' => [
-        'guard' => 'web',
-        'passwords' => 'users',
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Authentication Guards
-    |--------------------------------------------------------------------------
-    |
-    | Next, you may define every authentication guard for your application.
-    | Of course, a great default configuration has been defined for you
-    | here which uses session storage and the Eloquent user provider.
-    |
-    | All authentication drivers have a user provider. This defines how the
-    | users are actually retrieved out of your database or other storage
-    | mechanisms used by this application to persist your user's data.
-    |
-    | Supported: "session", "token"
-    |
-    */
-
-    'guards' => [
-        'web' => [
-            'driver' => 'session',
-            'provider' => 'users',
-        ],
-
-        'api' => [
-            'driver' => 'token',
-            'provider' => 'users',
-        ],
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | User Providers
-    |--------------------------------------------------------------------------
-    |
-    | All authentication drivers have a user provider. This defines how the
-    | users are actually retrieved out of your database or other storage
-    | mechanisms used by this application to persist your user's data.
-    |
-    | If you have multiple user tables or models you may configure multiple
-    | sources which represent each model / table. These sources may then
-    | be assigned to any extra authentication guards you have defined.
-    |
-    | Supported: "database", "eloquent"
-    |
-    */
-
-    'providers' => [
-        'users' => [
-            'driver' => 'eloquent',
-            'model' => App\User::class,
-        ],
-
-        // 'users' => [
-        //     'driver' => 'database',
-        //     'table' => 'users',
-        // ],
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Resetting Passwords
-    |--------------------------------------------------------------------------
-    |
-    | You may specify multiple password reset configurations if you have more
-    | than one user table or model in the application and you want to have
-    | separate password reset settings based on the specific user types.
-    |
-    | The expire time is the number of minutes that the reset token should be
-    | considered valid. This security feature keeps tokens short-lived so
-    | they have less time to be guessed. You may change this as needed.
-    |
-    */
-
-    'passwords' => [
-        'users' => [
-            'provider' => 'users',
-            'table' => 'password_resets',
-            'expire' => 60,
-        ],
-    ],
-
-];

+ 0 - 59
frameworks/PHP/laravel/config/broadcasting.php

@@ -1,59 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Broadcaster
-    |--------------------------------------------------------------------------
-    |
-    | This option controls the default broadcaster that will be used by the
-    | framework when an event needs to be broadcast. You may set this to
-    | any of the connections defined in the "connections" array below.
-    |
-    | Supported: "pusher", "redis", "log", "null"
-    |
-    */
-
-    'default' => env('BROADCAST_DRIVER', 'null'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Broadcast Connections
-    |--------------------------------------------------------------------------
-    |
-    | Here you may define all of the broadcast connections that will be used
-    | to broadcast events to other systems or over websockets. Samples of
-    | each available type of connection are provided inside this array.
-    |
-    */
-
-    'connections' => [
-
-        'pusher' => [
-            'driver' => 'pusher',
-            'key' => env('PUSHER_APP_KEY'),
-            'secret' => env('PUSHER_APP_SECRET'),
-            'app_id' => env('PUSHER_APP_ID'),
-            'options' => [
-                'cluster' => env('PUSHER_APP_CLUSTER'),
-                'encrypted' => true,
-            ],
-        ],
-
-        'redis' => [
-            'driver' => 'redis',
-            'connection' => 'default',
-        ],
-
-        'log' => [
-            'driver' => 'log',
-        ],
-
-        'null' => [
-            'driver' => 'null',
-        ],
-
-    ],
-
-];

+ 0 - 69
frameworks/PHP/laravel/config/filesystems.php

@@ -1,69 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Filesystem Disk
-    |--------------------------------------------------------------------------
-    |
-    | Here you may specify the default filesystem disk that should be used
-    | by the framework. The "local" disk, as well as a variety of cloud
-    | based disks are available to your application. Just store away!
-    |
-    */
-
-    'default' => env('FILESYSTEM_DRIVER', 'local'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Cloud Filesystem Disk
-    |--------------------------------------------------------------------------
-    |
-    | Many applications store files both locally and in the cloud. For this
-    | reason, you may specify a default "cloud" driver here. This driver
-    | will be bound as the Cloud disk implementation in the container.
-    |
-    */
-
-    'cloud' => env('FILESYSTEM_CLOUD', 's3'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Filesystem Disks
-    |--------------------------------------------------------------------------
-    |
-    | Here you may configure as many filesystem "disks" as you wish, and you
-    | may even configure multiple disks of the same driver. Defaults have
-    | been setup for each driver as an example of the required options.
-    |
-    | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
-    |
-    */
-
-    'disks' => [
-
-        'local' => [
-            'driver' => 'local',
-            'root' => storage_path('app'),
-        ],
-
-        'public' => [
-            'driver' => 'local',
-            'root' => storage_path('app/public'),
-            'url' => env('APP_URL').'/storage',
-            'visibility' => 'public',
-        ],
-
-        's3' => [
-            'driver' => 's3',
-            'key' => env('AWS_ACCESS_KEY_ID'),
-            'secret' => env('AWS_SECRET_ACCESS_KEY'),
-            'region' => env('AWS_DEFAULT_REGION'),
-            'bucket' => env('AWS_BUCKET'),
-            'url' => env('AWS_URL'),
-        ],
-
-    ],
-
-];

+ 0 - 20
frameworks/PHP/laravel/config/hashing.php

@@ -1,20 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Hash Driver
-    |--------------------------------------------------------------------------
-    |
-    | This option controls the default hash driver that will be used to hash
-    | passwords for your application. By default, the bcrypt algorithm is
-    | used; however, you remain free to modify this option if you wish.
-    |
-    | Supported: "bcrypt", "argon"
-    |
-    */
-
-    'driver' => 'bcrypt',
-
-];

+ 0 - 70
frameworks/PHP/laravel/config/logging.php

@@ -1,70 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Log Channel
-    |--------------------------------------------------------------------------
-    |
-    | This option defines the default log channel that gets used when writing
-    | messages to the logs. The name specified in this option should match
-    | one of the channels defined in the "channels" configuration array.
-    |
-    */
-
-    'default' => env('LOG_CHANNEL', 'stack'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Log Channels
-    |--------------------------------------------------------------------------
-    |
-    | Here you may configure the log channels for your application. Out of
-    | the box, Laravel uses the Monolog PHP logging library. This gives
-    | you a variety of powerful log handlers / formatters to utilize.
-    |
-    | Available Drivers: "single", "daily", "slack", "syslog",
-    |                    "errorlog", "custom", "stack"
-    |
-    */
-
-    'channels' => [
-        'stack' => [
-            'driver' => 'stack',
-            'channels' => ['single'],
-        ],
-
-        'single' => [
-            'driver' => 'single',
-            'path' => storage_path('logs/laravel.log'),
-            'level' => 'debug',
-        ],
-
-        'daily' => [
-            'driver' => 'daily',
-            'path' => storage_path('logs/laravel.log'),
-            'level' => 'debug',
-            'days' => 7,
-        ],
-
-        'slack' => [
-            'driver' => 'slack',
-            'url' => env('LOG_SLACK_WEBHOOK_URL'),
-            'username' => 'Laravel Log',
-            'emoji' => ':boom:',
-            'level' => 'critical',
-        ],
-
-        'syslog' => [
-            'driver' => 'syslog',
-            'level' => 'debug',
-        ],
-
-        'errorlog' => [
-            'driver' => 'errorlog',
-            'level' => 'debug',
-        ],
-    ],
-
-];

+ 0 - 123
frameworks/PHP/laravel/config/mail.php

@@ -1,123 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Mail Driver
-    |--------------------------------------------------------------------------
-    |
-    | Laravel supports both SMTP and PHP's "mail" function as drivers for the
-    | sending of e-mail. You may specify which one you're using throughout
-    | your application here. By default, Laravel is setup for SMTP mail.
-    |
-    | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
-    |            "sparkpost", "log", "array"
-    |
-    */
-
-    'driver' => env('MAIL_DRIVER', 'smtp'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | SMTP Host Address
-    |--------------------------------------------------------------------------
-    |
-    | Here you may provide the host address of the SMTP server used by your
-    | applications. A default option is provided that is compatible with
-    | the Mailgun mail service which will provide reliable deliveries.
-    |
-    */
-
-    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | SMTP Host Port
-    |--------------------------------------------------------------------------
-    |
-    | This is the SMTP port used by your application to deliver e-mails to
-    | users of the application. Like the host we have set this value to
-    | stay compatible with the Mailgun e-mail application by default.
-    |
-    */
-
-    'port' => env('MAIL_PORT', 587),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Global "From" Address
-    |--------------------------------------------------------------------------
-    |
-    | You may wish for all e-mails sent by your application to be sent from
-    | the same address. Here, you may specify a name and address that is
-    | used globally for all e-mails that are sent by your application.
-    |
-    */
-
-    'from' => [
-        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
-        'name' => env('MAIL_FROM_NAME', 'Example'),
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | E-Mail Encryption Protocol
-    |--------------------------------------------------------------------------
-    |
-    | Here you may specify the encryption protocol that should be used when
-    | the application send e-mail messages. A sensible default using the
-    | transport layer security protocol should provide great security.
-    |
-    */
-
-    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | SMTP Server Username
-    |--------------------------------------------------------------------------
-    |
-    | If your SMTP server requires a username for authentication, you should
-    | set it here. This will get used to authenticate with your server on
-    | connection. You may also set the "password" value below this one.
-    |
-    */
-
-    'username' => env('MAIL_USERNAME'),
-
-    'password' => env('MAIL_PASSWORD'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Sendmail System Path
-    |--------------------------------------------------------------------------
-    |
-    | When using the "sendmail" driver to send e-mails, we will need to know
-    | the path to where Sendmail lives on this server. A default path has
-    | been provided here, which will work well on most of your systems.
-    |
-    */
-
-    'sendmail' => '/usr/sbin/sendmail -bs',
-
-    /*
-    |--------------------------------------------------------------------------
-    | Markdown Mail Settings
-    |--------------------------------------------------------------------------
-    |
-    | If you are using Markdown based email rendering, you may configure your
-    | theme and component paths here, allowing you to customize the design
-    | of the emails. Or, you may simply stick with the Laravel defaults!
-    |
-    */
-
-    'markdown' => [
-        'theme' => 'default',
-
-        'paths' => [
-            resource_path('views/vendor/mail'),
-        ],
-    ],
-
-];

+ 0 - 38
frameworks/PHP/laravel/config/services.php

@@ -1,38 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Third Party Services
-    |--------------------------------------------------------------------------
-    |
-    | This file is for storing the credentials for third party services such
-    | as Stripe, Mailgun, SparkPost and others. This file provides a sane
-    | default location for this type of information, allowing packages
-    | to have a conventional place to find your various credentials.
-    |
-    */
-
-    'mailgun' => [
-        'domain' => env('MAILGUN_DOMAIN'),
-        'secret' => env('MAILGUN_SECRET'),
-    ],
-
-    'ses' => [
-        'key' => env('SES_KEY'),
-        'secret' => env('SES_SECRET'),
-        'region' => 'us-east-1',
-    ],
-
-    'sparkpost' => [
-        'secret' => env('SPARKPOST_SECRET'),
-    ],
-
-    'stripe' => [
-        'model' => App\User::class,
-        'key' => env('STRIPE_KEY'),
-        'secret' => env('STRIPE_SECRET'),
-    ],
-
-];

+ 0 - 197
frameworks/PHP/laravel/config/session.php

@@ -1,197 +0,0 @@
-<?php
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | Default Session Driver
-    |--------------------------------------------------------------------------
-    |
-    | This option controls the default session "driver" that will be used on
-    | requests. By default, we will use the lightweight native driver but
-    | you may specify any of the other wonderful drivers provided here.
-    |
-    | Supported: "file", "cookie", "database", "apc",
-    |            "memcached", "redis", "array"
-    |
-    */
-
-    'driver' => env('SESSION_DRIVER', 'file'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Lifetime
-    |--------------------------------------------------------------------------
-    |
-    | Here you may specify the number of minutes that you wish the session
-    | to be allowed to remain idle before it expires. If you want them
-    | to immediately expire on the browser closing, set that option.
-    |
-    */
-
-    'lifetime' => env('SESSION_LIFETIME', 120),
-
-    'expire_on_close' => false,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Encryption
-    |--------------------------------------------------------------------------
-    |
-    | This option allows you to easily specify that all of your session data
-    | should be encrypted before it is stored. All encryption will be run
-    | automatically by Laravel and you can use the Session like normal.
-    |
-    */
-
-    'encrypt' => false,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session File Location
-    |--------------------------------------------------------------------------
-    |
-    | When using the native session driver, we need a location where session
-    | files may be stored. A default has been set for you but a different
-    | location may be specified. This is only needed for file sessions.
-    |
-    */
-
-    'files' => storage_path('framework/sessions'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Database Connection
-    |--------------------------------------------------------------------------
-    |
-    | When using the "database" or "redis" session drivers, you may specify a
-    | connection that should be used to manage these sessions. This should
-    | correspond to a connection in your database configuration options.
-    |
-    */
-
-    'connection' => null,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Database Table
-    |--------------------------------------------------------------------------
-    |
-    | When using the "database" session driver, you may specify the table we
-    | should use to manage the sessions. Of course, a sensible default is
-    | provided for you; however, you are free to change this as needed.
-    |
-    */
-
-    'table' => 'sessions',
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Cache Store
-    |--------------------------------------------------------------------------
-    |
-    | When using the "apc" or "memcached" session drivers, you may specify a
-    | cache store that should be used for these sessions. This value must
-    | correspond with one of the application's configured cache stores.
-    |
-    */
-
-    'store' => null,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Sweeping Lottery
-    |--------------------------------------------------------------------------
-    |
-    | Some session drivers must manually sweep their storage location to get
-    | rid of old sessions from storage. Here are the chances that it will
-    | happen on a given request. By default, the odds are 2 out of 100.
-    |
-    */
-
-    'lottery' => [2, 100],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Cookie Name
-    |--------------------------------------------------------------------------
-    |
-    | Here you may change the name of the cookie used to identify a session
-    | instance by ID. The name specified here will get used every time a
-    | new session cookie is created by the framework for every driver.
-    |
-    */
-
-    'cookie' => env(
-        'SESSION_COOKIE',
-        str_slug(env('APP_NAME', 'laravel'), '_').'_session'
-    ),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Cookie Path
-    |--------------------------------------------------------------------------
-    |
-    | The session cookie path determines the path for which the cookie will
-    | be regarded as available. Typically, this will be the root path of
-    | your application but you are free to change this when necessary.
-    |
-    */
-
-    'path' => '/',
-
-    /*
-    |--------------------------------------------------------------------------
-    | Session Cookie Domain
-    |--------------------------------------------------------------------------
-    |
-    | Here you may change the domain of the cookie used to identify a session
-    | in your application. This will determine which domains the cookie is
-    | available to in your application. A sensible default has been set.
-    |
-    */
-
-    'domain' => env('SESSION_DOMAIN', null),
-
-    /*
-    |--------------------------------------------------------------------------
-    | HTTPS Only Cookies
-    |--------------------------------------------------------------------------
-    |
-    | By setting this option to true, session cookies will only be sent back
-    | to the server if the browser has a HTTPS connection. This will keep
-    | the cookie from being sent to you if it can not be done securely.
-    |
-    */
-
-    'secure' => env('SESSION_SECURE_COOKIE', false),
-
-    /*
-    |--------------------------------------------------------------------------
-    | HTTP Access Only
-    |--------------------------------------------------------------------------
-    |
-    | Setting this value to true will prevent JavaScript from accessing the
-    | value of the cookie and the cookie will only be accessible through
-    | the HTTP protocol. You are free to modify this option if needed.
-    |
-    */
-
-    'http_only' => true,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Same-Site Cookies
-    |--------------------------------------------------------------------------
-    |
-    | This option determines how your cookies behave when cross-site requests
-    | take place, and can be used to mitigate CSRF attacks. By default, we
-    | do not enable this as other CSRF protection services are in place.
-    |
-    | Supported: "lax", "strict"
-    |
-    */
-
-    'same_site' => null,
-
-];

+ 36 - 38
frameworks/PHP/laravel/config/swoole_http.php

@@ -1,41 +1,39 @@
 <?php
-
 if (env('APP_SWOOLE', false)) {
-    return [
-        /*
-        |--------------------------------------------------------------------------
-        | HTTP server configurations.
-        |--------------------------------------------------------------------------
-        |
-        | @see https://wiki.swoole.com/wiki/page/274.html
-        |
-        */
-        'server' => [
-            'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
-            'port' => env('SWOOLE_HTTP_PORT', '8080'),
-            'options' => [
-                'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('swoole_http.pid')),
-                // 'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
-                'daemonize' => env('SWOOLE_HTTP_DAEMONIZE', 0),
-                'handle_static_files' => env('SWOOLE_HTTP_STATIC', 0),
-                'public_path' => storage_path('app/public'),
-                'ob_output' => env('SWOOLE_HTTP_OB_OUTPUT', 0),
-                // Normally this value should be 1~4 times lager according to your cpu cores
-                'reactor_num' => env('SWOOLE_HTTP_REACTOR_NUM', swoole_cpu_num() * 2),
-                'worker_num' => env('SWOOLE_HTTP_WORKER_NUM', swoole_cpu_num() * 2),
-                'task_worker_num' => env('SWOOLE_HTTP_TASK_WORKER_NUM', swoole_cpu_num() * 2),
-                // This value should be larger than `post_max_size` and `upload_max_filesize` in `php.ini`.
-                // This equals to 10 MB
-                'package_max_length' => 10 * 1024 * 1024,
-                'buffer_output_size' => 10 * 1024 * 1024,
-                // Max buffer size for socket connections
-                'socket_buffer_size' => 128 * 1024 * 1024,
-                // Worker will restart after processing this number of request
-                'max_request' => 3000,
-            ],
-        ],
-        'providers' => [
-            // App\Providers\AuthServiceProvider::class,
-        ]
-    ];
+	return [
+		/*
+		 * |--------------------------------------------------------------------------
+		 * | HTTP server configurations.
+		 * |--------------------------------------------------------------------------
+		 * |
+		 * | @see https://wiki.swoole.com/wiki/page/274.html
+		 * |
+		 */
+		'server' => [
+			'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
+			'port' => env('SWOOLE_HTTP_PORT', '8080'),
+			'options' => [
+				'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('swoole_http.pid')),
+				// 'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
+				'daemonize' => env('SWOOLE_HTTP_DAEMONIZE', 0),
+				// 'handle_static_files' => env('SWOOLE_HTTP_STATIC', 0),
+				// 'public_path' => storage_path('app/public'),
+				// 'ob_output' => env('SWOOLE_HTTP_OB_OUTPUT', 0),
+				// Normally this value should be 1~4 times lager according to your cpu cores
+				'reactor_num' => env('SWOOLE_HTTP_REACTOR_NUM', swoole_cpu_num() * 2),
+				'worker_num' => env('SWOOLE_HTTP_WORKER_NUM', swoole_cpu_num() * 2),
+				'task_worker_num' => env('SWOOLE_HTTP_TASK_WORKER_NUM', swoole_cpu_num() * 2),
+				// This value should be larger than `post_max_size` and `upload_max_filesize` in `php.ini`.
+				// This equals to 10 MB
+				'package_max_length' => 10 * 1024 * 1024,
+				'buffer_output_size' => 10 * 1024 * 1024,
+				// Max buffer size for socket connections
+				'socket_buffer_size' => 128 * 1024 * 1024,
+				// Worker will restart after processing this number of request
+				'max_request' => 3000
+			]
+		],
+		'providers' => [ // App\Providers\AuthServiceProvider::class,
+		]
+	];
 }

+ 1 - 1
frameworks/PHP/laravel/deploy/swoole/composer.json

@@ -12,7 +12,7 @@
         "fideloper/proxy": "^4.0",
         "laravel/framework": "5.8.*",
         "laravel/tinker": "^1.0",
-        "swooletw/laravel-swoole": "v2.6.5.3"
+        "swooletw/laravel-swoole": "^v2.6"
     },
     "require-dev": {
         "beyondcode/laravel-dump-server": "^1.0",

+ 0 - 31
frameworks/PHP/laravel/phpunit.xml

@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit backupGlobals="false"
-         backupStaticAttributes="false"
-         bootstrap="vendor/autoload.php"
-         colors="true"
-         convertErrorsToExceptions="true"
-         convertNoticesToExceptions="true"
-         convertWarningsToExceptions="true"
-         processIsolation="false"
-         stopOnFailure="false">
-    <testsuites>
-        <testsuite name="Feature">
-            <directory suffix="Test.php">./tests/Feature</directory>
-        </testsuite>
-
-        <testsuite name="Unit">
-            <directory suffix="Test.php">./tests/Unit</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="SESSION_DRIVER" value="array"/>
-        <env name="QUEUE_DRIVER" value="sync"/>
-    </php>
-</phpunit>

+ 0 - 21
frameworks/PHP/laravel/public/.htaccess

@@ -1,21 +0,0 @@
-<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 - 2
frameworks/PHP/laravel/public/robots.txt

@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:

+ 0 - 25
frameworks/PHP/laravel/tests/CreatesApplication.php

@@ -1,25 +0,0 @@
-<?php
-
-namespace Tests;
-
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Contracts\Console\Kernel;
-
-trait CreatesApplication
-{
-    /**
-     * Creates the application.
-     *
-     * @return \Illuminate\Foundation\Application
-     */
-    public function createApplication()
-    {
-        $app = require __DIR__.'/../bootstrap/app.php';
-
-        $app->make(Kernel::class)->bootstrap();
-
-        Hash::driver('bcrypt')->setRounds(4);
-
-        return $app;
-    }
-}

+ 0 - 21
frameworks/PHP/laravel/tests/Feature/ExampleTest.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace Tests\Feature;
-
-use Tests\TestCase;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-
-class ExampleTest extends TestCase
-{
-    /**
-     * A basic test example.
-     *
-     * @return void
-     */
-    public function testBasicTest()
-    {
-        $response = $this->get('/');
-
-        $response->assertStatus(200);
-    }
-}

+ 0 - 10
frameworks/PHP/laravel/tests/TestCase.php

@@ -1,10 +0,0 @@
-<?php
-
-namespace Tests;
-
-use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
-
-abstract class TestCase extends BaseTestCase
-{
-    use CreatesApplication;
-}

+ 0 - 19
frameworks/PHP/laravel/tests/Unit/ExampleTest.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace Tests\Unit;
-
-use Tests\TestCase;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-
-class ExampleTest extends TestCase
-{
-    /**
-     * A basic test example.
-     *
-     * @return void
-     */
-    public function testBasicTest()
-    {
-        $this->assertTrue(true);
-    }
-}

+ 0 - 0
frameworks/PHP/lumen/readme.md → frameworks/PHP/lumen/README.md


+ 0 - 10
frameworks/PHP/lumen/app/Events/Event.php

@@ -1,10 +0,0 @@
-<?php
-
-namespace App\Events;
-
-use Illuminate\Queue\SerializesModels;
-
-abstract class Event
-{
-    use SerializesModels;
-}

+ 0 - 16
frameworks/PHP/lumen/app/Events/ExampleEvent.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Events;
-
-class ExampleEvent extends Event
-{
-    /**
-     * Create a new event instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        //
-    }
-}

+ 0 - 44
frameworks/PHP/lumen/app/Http/Middleware/Authenticate.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Http\Middleware;
-
-use Closure;
-use Illuminate\Contracts\Auth\Factory as Auth;
-
-class Authenticate
-{
-    /**
-     * The authentication guard factory instance.
-     *
-     * @var \Illuminate\Contracts\Auth\Factory
-     */
-    protected $auth;
-
-    /**
-     * Create a new middleware instance.
-     *
-     * @param  \Illuminate\Contracts\Auth\Factory  $auth
-     * @return void
-     */
-    public function __construct(Auth $auth)
-    {
-        $this->auth = $auth;
-    }
-
-    /**
-     * Handle an incoming request.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Closure  $next
-     * @param  string|null  $guard
-     * @return mixed
-     */
-    public function handle($request, Closure $next, $guard = null)
-    {
-        if ($this->auth->guard($guard)->guest()) {
-            return response('Unauthorized.', 401);
-        }
-
-        return $next($request);
-    }
-}

+ 0 - 20
frameworks/PHP/lumen/app/Http/Middleware/ExampleMiddleware.php

@@ -1,20 +0,0 @@
-<?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 - 26
frameworks/PHP/lumen/app/Jobs/ExampleJob.php

@@ -1,26 +0,0 @@
-<?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 - 24
frameworks/PHP/lumen/app/Jobs/Job.php

@@ -1,24 +0,0 @@
-<?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 - 31
frameworks/PHP/lumen/app/Listeners/ExampleListener.php

@@ -1,31 +0,0 @@
-<?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)
-    {
-        //
-    }
-}

+ 2 - 3
frameworks/PHP/lumen/app/Models/Fortune.php

@@ -1,12 +1,11 @@
 <?php
-
 namespace App\Models;
 
 use Illuminate\Database\Eloquent\Model;
 
 class Fortune extends Model {
 
-	protected $table = "Fortune";
+	protected $table = 'Fortune';
+
 	public $timestamps = false;
-	
 }

+ 0 - 18
frameworks/PHP/lumen/app/Providers/AppServiceProvider.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Providers;
-
-use Illuminate\Support\ServiceProvider;
-
-class AppServiceProvider extends ServiceProvider
-{
-    /**
-     * Register any application services.
-     *
-     * @return void
-     */
-    public function register()
-    {
-        //
-    }
-}

+ 0 - 39
frameworks/PHP/lumen/app/Providers/AuthServiceProvider.php

@@ -1,39 +0,0 @@
-<?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 - 19
frameworks/PHP/lumen/app/Providers/EventServiceProvider.php

@@ -1,19 +0,0 @@
-<?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\SomeEvent' => [
-            'App\Listeners\EventListener',
-        ],
-    ];
-}

+ 0 - 32
frameworks/PHP/lumen/app/User.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App;
-
-use Illuminate\Auth\Authenticatable;
-use Laravel\Lumen\Auth\Authorizable;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
-use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
-
-class User extends Model implements AuthenticatableContract, AuthorizableContract
-{
-    use Authenticatable, Authorizable;
-
-    /**
-     * The attributes that are mass assignable.
-     *
-     * @var array
-     */
-    protected $fillable = [
-        'name', 'email',
-    ];
-
-    /**
-     * The attributes excluded from the model's JSON form.
-     *
-     * @var array
-     */
-    protected $hidden = [
-        'password',
-    ];
-}

+ 34 - 36
frameworks/PHP/lumen/config/swoole_http.php

@@ -1,39 +1,37 @@
 <?php
-
 return [
-    /*
-    |--------------------------------------------------------------------------
-    | HTTP server configurations.
-    |--------------------------------------------------------------------------
-    |
-    | @see https://wiki.swoole.com/wiki/page/274.html
-    |
-    */
-    'server' => [
-        'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
-        'port' => env('SWOOLE_HTTP_PORT', '8080'),
-        'options' => [
-            'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('swoole_http.pid')),
-            // 'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
-            'daemonize' => env('SWOOLE_HTTP_DAEMONIZE', 0),
-            'handle_static_files' => env('SWOOLE_HTTP_STATIC', 0),
-            'public_path' => storage_path('app/public'),
-            'ob_output' => env('SWOOLE_HTTP_OB_OUTPUT', 0),
-            // Normally this value should be 1~4 times lager according to your cpu cores
-            'reactor_num' => env('SWOOLE_HTTP_REACTOR_NUM', swoole_cpu_num() * 2),
-            'worker_num' => env('SWOOLE_HTTP_WORKER_NUM', swoole_cpu_num() * 2),
-            'task_worker_num' => env('SWOOLE_HTTP_TASK_WORKER_NUM', swoole_cpu_num() * 2),
-            // This value should be larger than `post_max_size` and `upload_max_filesize` in `php.ini`.
-            // This equals to 10 MB
-            'package_max_length' => 10 * 1024 * 1024,
-            'buffer_output_size' => 10 * 1024 * 1024,
-            // Max buffer size for socket connections
-            'socket_buffer_size' => 128 * 1024 * 1024,
-            // Worker will restart after processing this number of request
-            'max_request' => 3000,
-        ],
-    ],
-    'providers' => [
-        // App\Providers\AuthServiceProvider::class,
-    ]
+	/*
+	 * |--------------------------------------------------------------------------
+	 * | HTTP server configurations.
+	 * |--------------------------------------------------------------------------
+	 * |
+	 * | @see https://wiki.swoole.com/wiki/page/274.html
+	 * |
+	 */
+	'server' => [
+		'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
+		'port' => env('SWOOLE_HTTP_PORT', '8080'),
+		'options' => [
+			'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('swoole_http.pid')),
+			// 'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
+			'daemonize' => env('SWOOLE_HTTP_DAEMONIZE', 0),
+			// 'handle_static_files' => env('SWOOLE_HTTP_STATIC', 0),
+			// 'public_path' => storage_path('app/public'),
+			// 'ob_output' => env('SWOOLE_HTTP_OB_OUTPUT', 0),
+			// Normally this value should be 1~4 times lager according to your cpu cores
+			'reactor_num' => env('SWOOLE_HTTP_REACTOR_NUM', swoole_cpu_num() * 2),
+			'worker_num' => env('SWOOLE_HTTP_WORKER_NUM', swoole_cpu_num() * 2),
+			'task_worker_num' => env('SWOOLE_HTTP_TASK_WORKER_NUM', swoole_cpu_num() * 2),
+			// This value should be larger than `post_max_size` and `upload_max_filesize` in `php.ini`.
+			// This equals to 10 MB
+			'package_max_length' => 10 * 1024 * 1024,
+			'buffer_output_size' => 10 * 1024 * 1024,
+			// Max buffer size for socket connections
+			'socket_buffer_size' => 128 * 1024 * 1024,
+			// Worker will restart after processing this number of request
+			'max_request' => 3000
+		]
+	],
+	'providers' => [ // App\Providers\AuthServiceProvider::class,
+	]
 ];

+ 1 - 1
frameworks/PHP/lumen/deploy/swoole/composer.json

@@ -8,7 +8,7 @@
         "php": ">=7.1.3",
         "laravel/lumen-framework": "5.8.*",
         "vlucas/phpdotenv": "^3.0",
-        "swooletw/laravel-swoole": "v2.6.5.3"
+        "swooletw/laravel-swoole": "^v2.6"
     },
     "require-dev": {
         "fzaninotto/faker": "~1.4",

+ 0 - 27
frameworks/PHP/lumen/phpunit.xml

@@ -1,27 +0,0 @@
-<?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>

+ 0 - 21
frameworks/PHP/lumen/tests/ExampleTest.php

@@ -1,21 +0,0 @@
-<?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()
-        );
-    }
-}

+ 0 - 14
frameworks/PHP/lumen/tests/TestCase.php

@@ -1,14 +0,0 @@
-<?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';
-    }
-}