feat: new xboard

This commit is contained in:
xboard
2025-01-21 14:57:54 +08:00
parent de18cfe596
commit 0f43fff242
373 changed files with 17923 additions and 20264 deletions
+3 -54
View File
@@ -161,7 +161,6 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Hhxsv5\LaravelS\Illuminate\LaravelSServiceProvider::class,
/*
* Package Service Providers...
@@ -170,64 +169,14 @@ return [
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\HorizonServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\SettingServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
App\Providers\OctaneSchedulerProvider::class,
App\Providers\PluginServiceProvider::class,
],
@@ -239,5 +188,5 @@ return [
| The only modification by laravel config
|
*/
'version' => '0.1.1-dev'
'version' => '1.0.0'
];
+3 -3
View File
@@ -14,7 +14,7 @@ return [
*/
'defaults' => [
'guard' => 'web',
'guard' => 'api',
'passwords' => 'users',
],
@@ -42,7 +42,7 @@ return [
],
'api' => [
'driver' => 'token',
'driver' => 'sanctum',
'provider' => 'users',
'hash' => false,
],
@@ -68,7 +68,7 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'model' => App\Models\User::class,
],
// 'users' => [
+4
View File
@@ -75,6 +75,10 @@ return [
'driver' => 'redis',
'connection' => 'cache',
],
'octane' => [
'driver' => 'octane'
],
'dynamodb' => [
'driver' => 'dynamodb',
+8 -2
View File
@@ -59,8 +59,14 @@ return [
'strict' => true,
'engine' => null,
'options' => (extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA')
]) : []) + [ \PDO::ATTR_PERSISTENT => true ],
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
PDO::ATTR_PERSISTENT => false,
]) : []),
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'idle_timeout' => 60,
],
],
'pgsql' => [
+5 -4
View File
@@ -3,8 +3,8 @@
use Illuminate\Support\Str;
use Linfo\Linfo;
$lInfo = new Linfo();
$parser = $lInfo->getParser();
// $lInfo = new Linfo();
// $parser = $lInfo->getParser();
return [
@@ -175,14 +175,15 @@ return [
'queue' => [
'order_handle',
'traffic_fetch',
'batch_traffic_fetch',
'stat',
'send_email',
'send_email_mass',
'send_telegram',
'online_sync'
],
'balance' => 'auto',
'minProcesses' => 1,
'maxProcesses' => (int)ceil($parser->getRam()['total'] / 1024 / 1024 / 1024 * 6),
'maxProcesses' => 20,
'tries' => 1,
'balanceCooldown' => 3,
],
-315
View File
@@ -1,315 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| LaravelS Settings
|--------------------------------------------------------------------------
|
| English https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#laravels-settings
| Chinese https://github.com/hhxsv5/laravel-s/blob/master/Settings-CN.md#laravels-%E9%85%8D%E7%BD%AE%E9%A1%B9
|
*/
/*
|--------------------------------------------------------------------------
| The IP address of the server
|--------------------------------------------------------------------------
|
| IPv4: use "127.0.0.1" to listen local address, and "0.0.0.0" to listen all addresses.
| IPv6: use "::1" to listen local address, and "::"(equivalent to 0:0:0:0:0:0:0:0) to listen all addresses.
|
*/
'listen_ip' => env('LARAVELS_LISTEN_IP', '127.0.0.1'),
/*
|--------------------------------------------------------------------------
| The port of the server
|--------------------------------------------------------------------------
|
| Require root privilege if port is less than 1024.
|
*/
'listen_port' => env('LARAVELS_LISTEN_PORT', 5200),
/*
|--------------------------------------------------------------------------
| The socket type of the server
|--------------------------------------------------------------------------
|
| Usually, you dont need to care about it.
| Unless you want Nginx to proxy to the UnixSocket Stream file, you need
| to modify it to SWOOLE_SOCK_UNIX_STREAM, and listen_ip is the path of UnixSocket Stream file.
| List of socket types:
| SWOOLE_SOCK_TCP: TCP
| SWOOLE_SOCK_TCP6: TCP IPv6
| SWOOLE_SOCK_UDP: UDP
| SWOOLE_SOCK_UDP6: UDP IPv6
| SWOOLE_UNIX_DGRAM: Unix socket dgram
| SWOOLE_UNIX_STREAM: Unix socket stream
| Enable SSL: $sock_type | SWOOLE_SSL. To enable SSL, check the configuration about SSL.
| https://www.swoole.co.uk/docs/modules/swoole-server-doc
| https://www.swoole.co.uk/docs/modules/swoole-server/configuration
|
*/
'socket_type' => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1,
/*
|--------------------------------------------------------------------------
| Server Name
|--------------------------------------------------------------------------
|
| This value represents the name of the server that will be
| displayed in the header of each request.
|
*/
'server' => env('LARAVELS_SERVER', 'LaravelS'),
/*
|--------------------------------------------------------------------------
| Handle Static Resource
|--------------------------------------------------------------------------
|
| Whether handle the static resource by LaravelS(Require Swoole >= 1.7.21, Handle by Swoole if Swoole >= 1.9.17).
| Suggest that Nginx handles the statics and LaravelS handles the dynamics.
| The default path of static resource is base_path('public'), you can modify swoole.document_root to change it.
|
*/
'handle_static' => env('LARAVELS_HANDLE_STATIC', false),
/*
|--------------------------------------------------------------------------
| Laravel Base Path
|--------------------------------------------------------------------------
|
| The basic path of Laravel, default base_path(), be used for symbolic link.
|
*/
'laravel_base_path' => env('LARAVEL_BASE_PATH', base_path()),
/*
|--------------------------------------------------------------------------
| Inotify Reload
|--------------------------------------------------------------------------
|
| This feature requires inotify extension.
| https://github.com/hhxsv5/laravel-s#automatically-reload-after-modifying-code
|
*/
'inotify_reload' => [
// Whether enable the Inotify Reload to reload all worker processes when your code is modified.
'enable' => env('LARAVELS_INOTIFY_RELOAD', false),
// The file path that Inotify watches
'watch_path' => base_path(),
// The file types that Inotify watches
'file_types' => ['.php'],
// The excluded/ignored directories that Inotify watches
'excluded_dirs' => [],
// Whether output the reload log
'log' => true,
],
/*
|--------------------------------------------------------------------------
| Swoole Event Handlers
|--------------------------------------------------------------------------
|
| Configure the event callback function of Swoole, key-value format,
| key is the event name, and value is the class that implements the event
| processing interface.
|
| https://github.com/hhxsv5/laravel-s#configuring-the-event-callback-function-of-swoole
|
*/
'event_handlers' => [],
/*
|--------------------------------------------------------------------------
| WebSockets
|--------------------------------------------------------------------------
|
| Swoole WebSocket Server settings.
|
| https://github.com/hhxsv5/laravel-s#enable-websocket-server
|
*/
'websocket' => [
'enable' => false,
// 'handler' => XxxWebSocketHandler::class,
],
/*
|--------------------------------------------------------------------------
| Sockets - multi-port mixed protocol
|--------------------------------------------------------------------------
|
| The socket(port) list for TCP/UDP.
|
| https://github.com/hhxsv5/laravel-s#multi-port-mixed-protocol
|
*/
'sockets' => [],
/*
|--------------------------------------------------------------------------
| Custom Process
|--------------------------------------------------------------------------
|
| Support developers to create custom processes for monitoring,
| reporting, or other special tasks.
|
| https://github.com/hhxsv5/laravel-s#custom-process
|
*/
'processes' => [],
/*
|--------------------------------------------------------------------------
| Timer
|--------------------------------------------------------------------------
|
| Wrapper cron job base on Swoole's Millisecond Timer, replace Linux Crontab.
|
| https://github.com/hhxsv5/laravel-s#millisecond-cron-job
|
*/
'timer' => [
'enable' => env('LARAVELS_TIMER', false),
// The list of cron job
'jobs' => [
// Enable LaravelScheduleJob to run `php artisan schedule:run` every 1 minute, replace Linux Crontab
Hhxsv5\LaravelS\Illuminate\LaravelScheduleJob::class,
],
// Max waiting time of reloading
'max_wait_time' => 5,
// Enable the global lock to ensure that only one instance starts the timer
// when deploying multiple instances.
// This feature depends on Redis https://laravel.com/docs/8.x/redis
'global_lock' => false,
'global_lock_key' => config('app.name', 'Laravel'),
],
/*
|--------------------------------------------------------------------------
| Swoole Tables
|--------------------------------------------------------------------------
|
| All defined tables will be created before Swoole starting.
|
| https://github.com/hhxsv5/laravel-s#use-swooletable
|
*/
'swoole_tables' => [],
/*
|--------------------------------------------------------------------------
| Re-register Providers
|--------------------------------------------------------------------------
|
| The Service Provider list, will be re-registered each request, and run method boot()
| if it exists. Usually, be used to clear the Service Provider
| which registers Singleton instances.
|
| https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#register_providers
|
*/
'register_providers' => [
// App\Providers\SettingServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Cleaners
|--------------------------------------------------------------------------
|
| The list of cleaners for each request is used to clean up some residual
| global variables, singleton objects, and static properties to avoid
| data pollution between requests.
|
| https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#cleaners
|
*/
'cleaners' => [
// Hhxsv5\LaravelS\Illuminate\Cleaners\SessionCleaner::class,
Hhxsv5\LaravelS\Illuminate\Cleaners\AuthCleaner::class,
],
/*
|--------------------------------------------------------------------------
| Destroy Controllers
|--------------------------------------------------------------------------
|
| Automatically destroy the controllers after each request to solve
| the problem of the singleton controllers.
|
| https://github.com/hhxsv5/laravel-s/blob/master/KnownIssues.md#singleton-controller
|
*/
'destroy_controllers' => [
'enable' => false,
'excluded_list' => [
// \App\Http\Controllers\V1\Server\UniProxyController::class
],
],
/*
|--------------------------------------------------------------------------
| Swoole Settings
|--------------------------------------------------------------------------
|
| Swoole's original configuration items.
|
| More settings
| Chinese https://wiki.swoole.com/#/server/setting
| English https://www.swoole.co.uk/docs/modules/swoole-server/configuration
|
*/
'swoole' => [
'daemonize' => env('LARAVELS_DAEMONIZE', false),
'dispatch_mode' => env('LARAVELS_DISPATCH_MODE', 3),
'worker_num' => env('LARAVELS_WORKER_NUM', 30),
//'task_worker_num' => env('LARAVELS_TASK_WORKER_NUM', 10),
'task_ipc_mode' => 1,
'task_max_request' => env('LARAVELS_TASK_MAX_REQUEST', 100000),
'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
'max_request' => env('LARAVELS_MAX_REQUEST', 100000),
'open_tcp_nodelay' => true,
'pid_file' => storage_path('laravels.pid'),
'log_level' => env('LARAVELS_LOG_LEVEL', 4),
'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
'document_root' => base_path('public'),
'buffer_output_size' => 2 * 1024 * 1024,
'socket_buffer_size' => 8 * 1024 * 1024,
'package_max_length' => 4 * 1024 * 1024,
'reload_async' => true,
'max_wait_time' => 60,
'enable_reuse_port' => true,
'enable_coroutine' => false,
'upload_tmp_dir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
'http_compression' => env('LARAVELS_HTTP_COMPRESSION', false),
],
];
+8 -1
View File
@@ -16,7 +16,7 @@ return [
|
*/
'default' => 'mysql',
'default' => 'daily',
/*
|--------------------------------------------------------------------------
@@ -100,6 +100,13 @@ return [
'driver' => 'errorlog',
'level' => 'debug',
],
'deprecations' => [
'driver' => 'daily',
'path' => storage_path('logs/deprecations.log'),
'level' => 'debug',
'days' => 14,
],
],
];
+221
View File
@@ -0,0 +1,221 @@
<?php
use Laravel\Octane\Contracts\OperationTerminated;
use Laravel\Octane\Events\RequestHandled;
use Laravel\Octane\Events\RequestReceived;
use Laravel\Octane\Events\RequestTerminated;
use Laravel\Octane\Events\TaskReceived;
use Laravel\Octane\Events\TaskTerminated;
use Laravel\Octane\Events\TickReceived;
use Laravel\Octane\Events\TickTerminated;
use Laravel\Octane\Events\WorkerErrorOccurred;
use Laravel\Octane\Events\WorkerStarting;
use Laravel\Octane\Events\WorkerStopping;
use Laravel\Octane\Listeners\CollectGarbage;
use Laravel\Octane\Listeners\DisconnectFromDatabases;
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
use Laravel\Octane\Listeners\FlushUploadedFiles;
use Laravel\Octane\Listeners\ReportException;
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
use Laravel\Octane\Octane;
return [
/*
|--------------------------------------------------------------------------
| Octane Server
|--------------------------------------------------------------------------
|
| This value determines the default "server" that will be used by Octane
| when starting, restarting, or stopping your server via the CLI. You
| are free to change this to the supported server of your choosing.
|
| Supported: "roadrunner", "swoole"
|
*/
'server' => env('OCTANE_SERVER', 'swoole'),
/*
|--------------------------------------------------------------------------
| Force HTTPS
|--------------------------------------------------------------------------
|
| When this configuration value is set to "true", Octane will inform the
| framework that all absolute links must be generated using the HTTPS
| protocol. Otherwise your links may be generated using plain HTTP.
|
*/
'https' => env('OCTANE_HTTPS', false),
/*
|--------------------------------------------------------------------------
| Octane Listeners
|--------------------------------------------------------------------------
|
| All of the event listeners for Octane's events are defined below. These
| listeners are responsible for resetting your application's state for
| the next request. You may even add your own listeners to the list.
|
*/
'listeners' => [
WorkerStarting::class => [
EnsureUploadedFilesAreValid::class,
EnsureUploadedFilesCanBeMoved::class,
],
RequestReceived::class => [
...Octane::prepareApplicationForNextOperation(),
...Octane::prepareApplicationForNextRequest(),
//
],
RequestHandled::class => [
//
],
RequestTerminated::class => [
// FlushUploadedFiles::class,
],
TaskReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TaskTerminated::class => [
//
],
TickReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TickTerminated::class => [
//
],
OperationTerminated::class => [
FlushTemporaryContainerInstances::class,
// DisconnectFromDatabases::class,
// CollectGarbage::class,
],
WorkerErrorOccurred::class => [
ReportException::class,
StopWorkerIfNecessary::class,
],
WorkerStopping::class => [
//
],
],
/*
|--------------------------------------------------------------------------
| Warm / Flush Bindings
|--------------------------------------------------------------------------
|
| The bindings listed below will either be pre-warmed when a worker boots
| or they will be flushed before every new request. Flushing a binding
| will force the container to resolve that binding again when asked.
|
*/
'warm' => [
...Octane::defaultServicesToWarm(),
],
'flush' => [
//
],
/*
|--------------------------------------------------------------------------
| Octane Cache Table
|--------------------------------------------------------------------------
|
| While using Swoole, you may leverage the Octane cache, which is powered
| by a Swoole table. You may set the maximum number of rows as well as
| the number of bytes per row using the configuration options below.
|
*/
'cache' => [
'rows' => 1000,
'bytes' => 10000,
],
/*
|--------------------------------------------------------------------------
| Octane Swoole Tables
|--------------------------------------------------------------------------
|
| While using Swoole, you may define additional tables as required by the
| application. These tables can be used to store data that needs to be
| quickly accessed by other workers on the particular Swoole server.
|
*/
'tables' => [
'example:1000' => [
'name' => 'string:1000',
'votes' => 'int',
],
],
/*
|--------------------------------------------------------------------------
| File Watching
|--------------------------------------------------------------------------
|
| The following list of files and directories will be watched when using
| the --watch option offered by Octane. If any of the directories and
| files are changed, Octane will automatically reload your workers.
|
*/
'watch' => [
'app',
'bootstrap',
'config',
'database',
'public/**/*.php',
'resources/**/*.php',
'routes',
'composer.lock',
'.env',
],
/*
|--------------------------------------------------------------------------
| Garbage Collection Threshold
|--------------------------------------------------------------------------
|
| When executing long-lived PHP scripts such as Octane, memory can build
| up before being cleared by PHP. You can force Octane to run garbage
| collection if your application consumes this amount of megabytes.
|
*/
'garbage' => 50,
/*
|--------------------------------------------------------------------------
| Maximum Execution Time
|--------------------------------------------------------------------------
|
| The following setting configures the maximum execution time for requests
| being handled by Octane. You may set this value to 0 to indicate that
| there isn't a specific time limit on Octane request execution time.
|
*/
'max_execution_time' => 30,
];
+83
View File
@@ -0,0 +1,83 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
],
];
+270
View File
@@ -0,0 +1,270 @@
<?php
use Knuckles\Scribe\Extracting\Strategies;
return [
// The HTML <title> for the generated documentation. If this is empty, Scribe will infer it from config('app.name').
'title' => null,
// A short description of your API. Will be included in the docs webpage, Postman collection and OpenAPI spec.
'description' => '',
// The base URL displayed in the docs. If this is empty, Scribe will use the value of config('app.url') at generation time.
// If you're using `laravel` type, you can set this to a dynamic string, like '{{ config("app.tenant_url") }}' to get a dynamic base URL.
'base_url' => null,
'routes' => [
[
// Routes that match these conditions will be included in the docs
'match' => [
// Match only routes whose paths match this pattern (use * as a wildcard to match any characters). Example: 'users/*'.
'prefixes' => ['api/*'],
// Match only routes whose domains match this pattern (use * as a wildcard to match any characters). Example: 'api.*'.
'domains' => ['*'],
// [Dingo router only] Match only routes registered under this version. Wildcards are NOT supported.
'versions' => ['v1'],
],
// Include these routes even if they did not match the rules above.
'include' => [
// 'users.index', 'POST /new', '/auth/*'
],
// Exclude these routes even if they matched the rules above.
'exclude' => [
// 'GET /health', 'admin.*'
],
],
],
// The type of documentation output to generate.
// - "static" will generate a static HTMl page in the /public/docs folder,
// - "laravel" will generate the documentation as a Blade view, so you can add routing and authentication.
// - "external_static" and "external_laravel" do the same as above, but generate a basic template,
// passing the OpenAPI spec as a URL, allowing you to easily use the docs with an external generator
'type' => 'static',
// See https://scribe.knuckles.wtf/laravel/reference/config#theme for supported options
'theme' => 'default',
'static' => [
// HTML documentation, assets and Postman collection will be generated to this folder.
// Source Markdown will still be in resources/docs.
'output_path' => 'public/docs',
],
'laravel' => [
// Whether to automatically create a docs endpoint for you to view your generated docs.
// If this is false, you can still set up routing manually.
'add_routes' => true,
// URL path to use for the docs endpoint (if `add_routes` is true).
// By default, `/docs` opens the HTML page, `/docs.postman` opens the Postman collection, and `/docs.openapi` the OpenAPI spec.
'docs_url' => '/docs',
// Directory within `public` in which to store CSS and JS assets.
// By default, assets are stored in `public/vendor/scribe`.
// If set, assets will be stored in `public/{{assets_directory}}`
'assets_directory' => null,
// Middleware to attach to the docs endpoint (if `add_routes` is true).
'middleware' => [],
],
'external' => [
'html_attributes' => []
],
'try_it_out' => [
// Add a Try It Out button to your endpoints so consumers can test endpoints right from their browser.
// Don't forget to enable CORS headers for your endpoints.
'enabled' => true,
// The base URL for the API tester to use (for example, you can set this to your staging URL).
// Leave as null to use the current app URL when generating (config("app.url")).
'base_url' => null,
// [Laravel Sanctum] Fetch a CSRF token before each request, and add it as an X-XSRF-TOKEN header.
'use_csrf' => false,
// The URL to fetch the CSRF token from (if `use_csrf` is true).
'csrf_url' => '/sanctum/csrf-cookie',
],
// How is your API authenticated? This information will be used in the displayed docs, generated examples and response calls.
'auth' => [
// Set this to true if ANY endpoints in your API use authentication.
'enabled' => false,
// Set this to true if your API should be authenticated by default. If so, you must also set `enabled` (above) to true.
// You can then use @unauthenticated or @authenticated on individual endpoints to change their status from the default.
'default' => false,
// Where is the auth value meant to be sent in a request?
// Options: query, body, basic, bearer, header (for custom header)
'in' => 'bearer',
// The name of the auth parameter (e.g. token, key, apiKey) or header (e.g. Authorization, Api-Key).
'name' => 'key',
// The value of the parameter to be used by Scribe to authenticate response calls.
// This will NOT be included in the generated documentation. If empty, Scribe will use a random value.
'use_value' => env('SCRIBE_AUTH_KEY'),
// Placeholder your users will see for the auth parameter in the example requests.
// Set this to null if you want Scribe to use a random value as placeholder instead.
'placeholder' => '{YOUR_AUTH_KEY}',
// Any extra authentication-related info for your users. Markdown and HTML are supported.
'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
],
// Text to place in the "Introduction" section, right after the `description`. Markdown and HTML are supported.
'intro_text' => <<<INTRO
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
INTRO
,
// Example requests for each endpoint will be shown in each of these languages.
// Supported options are: bash, javascript, php, python
// To add a language of your own, see https://scribe.knuckles.wtf/laravel/advanced/example-requests
'example_languages' => [
'bash',
'javascript',
],
// Generate a Postman collection (v2.1.0) in addition to HTML docs.
// For 'static' docs, the collection will be generated to public/docs/collection.json.
// For 'laravel' docs, it will be generated to storage/app/scribe/collection.json.
// Setting `laravel.add_routes` to true (above) will also add a route for the collection.
'postman' => [
'enabled' => true,
'overrides' => [
// 'info.version' => '2.0.0',
],
],
// Generate an OpenAPI spec (v3.0.1) in addition to docs webpage.
// For 'static' docs, the collection will be generated to public/docs/openapi.yaml.
// For 'laravel' docs, it will be generated to storage/app/scribe/openapi.yaml.
// Setting `laravel.add_routes` to true (above) will also add a route for the spec.
'openapi' => [
'enabled' => true,
'overrides' => [
// 'info.version' => '2.0.0',
],
],
'groups' => [
// Endpoints which don't have a @group will be placed in this default group.
'default' => 'Endpoints',
// By default, Scribe will sort groups alphabetically, and endpoints in the order their routes are defined.
// You can override this by listing the groups, subgroups and endpoints here in the order you want them.
// See https://scribe.knuckles.wtf/blog/laravel-v4#easier-sorting and https://scribe.knuckles.wtf/laravel/reference/config#order for details
'order' => [],
],
// Custom logo path. This will be used as the value of the src attribute for the <img> tag,
// so make sure it points to an accessible URL or path. Set to false to not use a logo.
// For example, if your logo is in public/img:
// - 'logo' => '../img/logo.png' // for `static` type (output folder is public/docs)
// - 'logo' => 'img/logo.png' // for `laravel` type
'logo' => false,
// Customize the "Last updated" value displayed in the docs by specifying tokens and formats.
// Examples:
// - {date:F j Y} => March 28, 2022
// - {git:short} => Short hash of the last Git commit
// Available tokens are `{date:<format>}` and `{git:<format>}`.
// The format you pass to `date` will be passed to PHP's `date()` function.
// The format you pass to `git` can be either "short" or "long".
'last_updated' => 'Last updated: {date:F j, Y}',
'examples' => [
// Set this to any number (e.g. 1234) to generate the same example values for parameters on each run,
'faker_seed' => null,
// With API resources and transformers, Scribe tries to generate example models to use in your API responses.
// By default, Scribe will try the model's factory, and if that fails, try fetching the first from the database.
// You can reorder or remove strategies here.
'models_source' => ['factoryCreate', 'factoryMake', 'databaseFirst'],
],
// The strategies Scribe will use to extract information about your routes at each stage.
// If you create or install a custom strategy, add it here.
'strategies' => [
'metadata' => [
Strategies\Metadata\GetFromDocBlocks::class,
Strategies\Metadata\GetFromMetadataAttributes::class,
],
'urlParameters' => [
Strategies\UrlParameters\GetFromLaravelAPI::class,
Strategies\UrlParameters\GetFromUrlParamAttribute::class,
Strategies\UrlParameters\GetFromUrlParamTag::class,
],
'queryParameters' => [
Strategies\QueryParameters\GetFromFormRequest::class,
Strategies\QueryParameters\GetFromInlineValidator::class,
Strategies\QueryParameters\GetFromQueryParamAttribute::class,
Strategies\QueryParameters\GetFromQueryParamTag::class,
],
'headers' => [
Strategies\Headers\GetFromHeaderAttribute::class,
Strategies\Headers\GetFromHeaderTag::class,
[
'override',
[
'Content-Type' => 'application/json',
'Accept' => 'application/json',
]
]
],
'bodyParameters' => [
Strategies\BodyParameters\GetFromFormRequest::class,
Strategies\BodyParameters\GetFromInlineValidator::class,
Strategies\BodyParameters\GetFromBodyParamAttribute::class,
Strategies\BodyParameters\GetFromBodyParamTag::class,
],
'responses' => [
Strategies\Responses\UseResponseAttributes::class,
Strategies\Responses\UseTransformerTags::class,
Strategies\Responses\UseApiResourceTags::class,
Strategies\Responses\UseResponseTag::class,
Strategies\Responses\UseResponseFileTag::class,
[
Strategies\Responses\ResponseCalls::class,
[
'only' => ['GET *'],
// Disable debug mode when generating response calls to avoid error stack traces in responses
'config' => [
'app.debug' => false,
],
]
]
],
'responseFields' => [
Strategies\ResponseFields\GetFromResponseFieldAttribute::class,
Strategies\ResponseFields\GetFromResponseFieldTag::class,
],
],
// For response calls, API resource responses and transformer responses,
// Scribe will try to start database transactions, so no changes are persisted to your database.
// Tell Scribe which connections should be transacted here. If you only use one db connection, you can leave this as is.
'database_connections_to_transact' => [config('database.default')],
'fractal' => [
// If you are using a custom serializer with league/fractal, you can specify it here.
'serializer' => null,
],
'routeMatcher' => \Knuckles\Scribe\Matching\RouteMatcher::class,
];
-137
View File
@@ -1,137 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| HTTP server configurations.
|--------------------------------------------------------------------------
|
| @see https://www.swoole.co.uk/docs/modules/swoole-server/configuration
|
*/
'server' => [
'host' => env('SWOOLE_HTTP_HOST', '0.0.0.0'),
'port' => env('SWOOLE_HTTP_PORT', '1215'),
'public_path' => base_path('public'),
// Determine if to use swoole to respond request for static files
'handle_static_files' => env('SWOOLE_HANDLE_STATIC', true),
'access_log' => env('SWOOLE_HTTP_ACCESS_LOG', false),
// You must add --enable-openssl while compiling Swoole
// Put `SWOOLE_SOCK_TCP | SWOOLE_SSL` if you want to enable SSL
'socket_type' => SWOOLE_SOCK_TCP,
'process_type' => SWOOLE_PROCESS,
'options' => [
'pid_file' => env('SWOOLE_HTTP_PID_FILE', base_path('storage/logs/swoole_http.pid')),
'log_file' => env('SWOOLE_HTTP_LOG_FILE', base_path('storage/logs/swoole_http.log')),
'daemonize' => env('SWOOLE_HTTP_DAEMONIZE', false),
// Normally this value should be 1~4 times larger according to your cpu cores.
'reactor_num' => env('SWOOLE_HTTP_REACTOR_NUM', swoole_cpu_num()),
'worker_num' => env('SWOOLE_HTTP_WORKER_NUM', swoole_cpu_num()),
'task_worker_num' => env('SWOOLE_HTTP_TASK_WORKER_NUM', swoole_cpu_num()),
// The data to receive can't be larger than buffer_output_size.
'package_max_length' => 20 * 1024 * 1024,
// The data to send can't be larger than buffer_output_size.
'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 requests
'max_request' => 3000,
// Enable coroutine send
'send_yield' => true,
// You must add --enable-openssl while compiling Swoole
'ssl_cert_file' => null,
'ssl_key_file' => null,
],
],
/*
|--------------------------------------------------------------------------
| Enable to turn on websocket server.
|--------------------------------------------------------------------------
*/
'websocket' => [
'enabled' => env('SWOOLE_HTTP_WEBSOCKET', false),
],
/*
|--------------------------------------------------------------------------
| Hot reload configuration
|--------------------------------------------------------------------------
*/
'hot_reload' => [
'enabled' => env('SWOOLE_HOT_RELOAD_ENABLE', false),
'recursively' => env('SWOOLE_HOT_RELOAD_RECURSIVELY', true),
'directory' => env('SWOOLE_HOT_RELOAD_DIRECTORY', base_path()),
'log' => env('SWOOLE_HOT_RELOAD_LOG', true),
'filter' => env('SWOOLE_HOT_RELOAD_FILTER', '.php'),
],
/*
|--------------------------------------------------------------------------
| Console output will be transferred to response content if enabled.
|--------------------------------------------------------------------------
*/
'ob_output' => env('SWOOLE_OB_OUTPUT', true),
/*
|--------------------------------------------------------------------------
| Pre-resolved instances here will be resolved when sandbox created.
|--------------------------------------------------------------------------
*/
'pre_resolved' => [
'view', 'files', 'session', 'session.store', 'routes',
'db', 'db.factory', 'cache', 'cache.store', 'config', 'cookie',
'encrypter', 'hash', 'router', 'translator', 'url', 'log',
],
/*
|--------------------------------------------------------------------------
| Instances here will be cleared on every request.
|--------------------------------------------------------------------------
*/
'instances' => [
'auth',
],
/*
|--------------------------------------------------------------------------
| Providers here will be registered on every request.
|--------------------------------------------------------------------------
*/
'providers' => [
Illuminate\Pagination\PaginationServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Resetters for sandbox app.
|--------------------------------------------------------------------------
*/
'resetters' => [
SwooleTW\Http\Server\Resetters\ResetConfig::class,
SwooleTW\Http\Server\Resetters\ResetSession::class,
SwooleTW\Http\Server\Resetters\ResetCookie::class,
SwooleTW\Http\Server\Resetters\ClearInstances::class,
SwooleTW\Http\Server\Resetters\BindRequest::class,
SwooleTW\Http\Server\Resetters\RebindKernelContainer::class,
SwooleTW\Http\Server\Resetters\RebindRouterContainer::class,
SwooleTW\Http\Server\Resetters\RebindViewContainer::class,
SwooleTW\Http\Server\Resetters\ResetProviders::class,
],
/*
|--------------------------------------------------------------------------
| Define your swoole tables here.
|
| @see https://www.swoole.co.uk/docs/modules/swoole-table
|--------------------------------------------------------------------------
*/
'tables' => [
// 'table_name' => [
// 'size' => 1024,
// 'columns' => [
// ['name' => 'column_name', 'type' => Table::TYPE_STRING, 'size' => 1024],
// ]
// ],
],
];
-107
View File
@@ -1,107 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Websocket handler for onOpen and onClose callback
| Replace this handler if you want to customize your websocket handler
|--------------------------------------------------------------------------
*/
'handler' => SwooleTW\Http\Websocket\SocketIO\WebsocketHandler::class,
/*
|--------------------------------------------------------------------------
| Default frame parser
| Replace it if you want to customize your websocket payload
|--------------------------------------------------------------------------
*/
'parser' => SwooleTW\Http\Websocket\SocketIO\SocketIOParser::class,
/*
|--------------------------------------------------------------------------
| Websocket route file path
|--------------------------------------------------------------------------
*/
'route_file' => base_path('routes/websocket.php'),
/*
|--------------------------------------------------------------------------
| Default middleware for on connect request
|--------------------------------------------------------------------------
*/
'middleware' => [
// SwooleTW\Http\Websocket\Middleware\DecryptCookies::class,
// SwooleTW\Http\Websocket\Middleware\StartSession::class,
// SwooleTW\Http\Websocket\Middleware\Authenticate::class,
],
/*
|--------------------------------------------------------------------------
| Websocket handler for customized onHandShake callback
|--------------------------------------------------------------------------
*/
'handshake' => [
'enabled' => false,
'handler' => SwooleTW\Http\Websocket\HandShakeHandler::class,
],
/*
|--------------------------------------------------------------------------
| Default websocket driver
|--------------------------------------------------------------------------
*/
'default' => 'table',
/*
|--------------------------------------------------------------------------
| Websocket client's heartbeat interval (ms)
|--------------------------------------------------------------------------
*/
'ping_interval' => 25000,
/*
|--------------------------------------------------------------------------
| Websocket client's heartbeat interval timeout (ms)
|--------------------------------------------------------------------------
*/
'ping_timeout' => 60000,
/*
|--------------------------------------------------------------------------
| Room drivers mapping
|--------------------------------------------------------------------------
*/
'drivers' => [
'table' => SwooleTW\Http\Websocket\Rooms\TableRoom::class,
'redis' => SwooleTW\Http\Websocket\Rooms\RedisRoom::class,
],
/*
|--------------------------------------------------------------------------
| Room drivers settings
|--------------------------------------------------------------------------
*/
'settings' => [
'table' => [
'room_rows' => 4096,
'room_size' => 2048,
'client_rows' => 8192,
'client_size' => 2048,
],
'redis' => [
'server' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'persistent' => true,
],
'options' => [
//
],
'prefix' => 'swoole:',
],
],
];