├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .idea └── .gitignore ├── LICENSE ├── Modules └── DomenyTv │ ├── App │ ├── Http │ │ ├── Controllers │ │ │ ├── .gitkeep │ │ │ ├── DomenyTvController.php │ │ │ ├── HandlerCommands │ │ │ │ ├── AccountBalance.php │ │ │ │ ├── CheckDomain.php │ │ │ │ ├── CheckDomainDns.php │ │ │ │ ├── CheckDomainExtended.php │ │ │ │ ├── HandlerCommendInterface.php │ │ │ │ └── Pricelist.php │ │ │ └── SoapHandler.php │ │ ├── Requests │ │ │ └── AccountBalanceRequest.php │ │ └── Resources │ │ │ └── AccountBalanceResource.php │ └── Providers │ │ ├── .gitkeep │ │ ├── DomenyTvServiceProvider.php │ │ └── RouteServiceProvider.php │ ├── Database │ └── Seeders │ │ ├── .gitkeep │ │ └── DomenyTvDatabaseSeeder.php │ ├── composer.json │ ├── config │ ├── .gitkeep │ └── config.php │ ├── docs │ ├── API2_documentation.pdf │ └── API2_dokumentacja.pdf │ ├── module.json │ ├── package.json │ ├── resources │ ├── assets │ │ ├── js │ │ │ └── app.js │ │ └── sass │ │ │ └── app.scss │ └── views │ │ ├── .gitkeep │ │ ├── index.blade.php │ │ └── layouts │ │ └── master.blade.php │ ├── routes │ ├── .gitkeep │ ├── api.php │ └── web.php │ ├── soap.wsdl.xml │ ├── tests │ ├── Feature │ │ ├── AccountBalanceCommendTest.php │ │ ├── CheckDomainExtendedCommendTest.php │ │ ├── CheckDomainTest.php │ │ ├── CommonTest.php │ │ ├── DomenyTvControllerTest.php │ │ ├── PricelistCommendTest.php │ │ └── UniversalCommandTest.php │ └── Unit │ │ └── AccountBalanceCommendTest.php │ └── vite.config.js ├── README.md ├── TODO.md ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ └── Controller.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ ├── ValidateSignature.php │ │ └── VerifyCsrfToken.php ├── Models │ └── User.php └── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── modules.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_reset_tokens_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ └── 2019_12_14_000001_create_personal_access_tokens_table.php └── seeders │ └── DatabaseSeeder.php ├── docker-compose.yml ├── logo-api-simulator.jpeg ├── modules_statuses.json ├── package.json ├── phpunit.xml ├── pint.json ├── public ├── .htaccess ├── favicon.ico ├── index.php ├── modules │ └── domenytv │ │ └── soap.wsdl.xml └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME="API simulator" 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=apis 15 | DB_USERNAME=root 16 | DB_PASSWORD=pass 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailpit 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_APP_NAME="${APP_NAME}" 55 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 56 | VITE_PUSHER_HOST="${PUSHER_HOST}" 57 | VITE_PUSHER_PORT="${PUSHER_PORT}" 58 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 59 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 60 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /vendor 8 | .env 9 | .env.backup 10 | .env.production 11 | .phpunit.result.cache 12 | Homestead.json 13 | Homestead.yaml 14 | auth.json 15 | npm-debug.log 16 | yarn-error.log 17 | /.fleet 18 | /.idea 19 | /.vscode 20 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Olsza 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/App/Http/Controllers/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/DomenyTvController.php: -------------------------------------------------------------------------------- 1 | checkIp(); 15 | 16 | if (! $checkIp) { 17 | $server = new SoapServer(null, ['uri' => 'urn:xmethods-delayed-quotes']); 18 | $soapHandler = new SoapHandler(); 19 | $server->setObject($soapHandler); 20 | ob_start(); 21 | $server->handle(); 22 | $response = ob_get_clean(); 23 | ob_end_clean(); 24 | } else { 25 | $response = $checkIp; 26 | } 27 | 28 | return response($response, 200)->header('Content-Type', 'text/xml'); 29 | } 30 | 31 | private function checkIp(): false | string 32 | { 33 | $ip = request()->ip(); 34 | if (! IpUtils::checkIp($ip, ['172.0.0.0/8', '127.0.0.1'])) { 35 | $outError = ' 37 | 38 | 39 | 69 40 | Unauthorized IP - ' . $ip . ' 41 | 42 | 43 | '; 44 | 45 | return $outError; 46 | } 47 | 48 | return false; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/HandlerCommands/AccountBalance.php: -------------------------------------------------------------------------------- 1 | login !== 'good_login' && $parameters->password !== 'good_password') { 12 | return ['result' => 27]; 13 | } 14 | 15 | return ['result' => 1000, 'balance' => (string) 3210.66]; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/HandlerCommands/CheckDomain.php: -------------------------------------------------------------------------------- 1 | login !== 'good_login' && $parameters->password !== 'good_password') { 10 | return ['result' => 27]; 11 | } 12 | 13 | if (! isset($parameters->domain)) { 14 | return ['result' => 16]; 15 | } 16 | 17 | if (! $this->isDomainValidationOk($parameters->domain)) { 18 | return ['result' => 1]; 19 | } 20 | 21 | [$name, $ext] = explode('.', $parameters->domain, 2); 22 | 23 | if (strlen($name) < 3) { 24 | return ['result' => 112]; 25 | } 26 | 27 | if ($parameters->domain === 'olsza.info') { 28 | return ['result' => 9076]; 29 | } 30 | 31 | return ['result' => 1000]; 32 | } 33 | 34 | private function isDomainValidationOk(?string $domain = ''): bool 35 | { 36 | if (empty($domain)) { 37 | return false; 38 | } 39 | 40 | if (! preg_match('/^[a-z0-9\.\-]+\.[a-z]{2,15}$/i', $domain)) { 41 | return false; 42 | } 43 | 44 | [$name, $ext] = explode('.', $domain, 2); 45 | 46 | if (strlen($name) > 63) { 47 | return false; 48 | } 49 | 50 | return true; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/HandlerCommands/CheckDomainDns.php: -------------------------------------------------------------------------------- 1 | login !== 'good_login' && $parameters->password !== 'good_password') { 12 | return ['result' => 27]; 13 | } 14 | 15 | if (! isset($parameters->domain)) { 16 | return ['result' => 16]; 17 | } 18 | 19 | if (empty($parameters->domain)) { 20 | return ['result' => 1]; 21 | } 22 | 23 | return ['result' => 1000, [ 24 | 'dns1' => 'dns.' . ($parameters->domain ?: 'olsza.info'), 25 | 'dns2' => 'dns2.' . ($parameters->domain ?: 'czlowiek.it'), 26 | 'dns3' => 'dns3.' . ($parameters->domain ?: 'domeny.tv'), 27 | ]]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/HandlerCommands/CheckDomainExtended.php: -------------------------------------------------------------------------------- 1 | login !== 'good_login' && $parameters->password !== 'good_password') { 10 | return ['result' => 27]; 11 | } 12 | 13 | if (! isset($parameters->domain)) { 14 | return ['result' => 16]; 15 | } 16 | 17 | if (empty($parameters->domain)) { 18 | return ['result' => 1]; 19 | } 20 | 21 | if ($parameters->domain === 'olsza.otto') { 22 | return ['result' => 1000, 'premium' => 'true', 'price' => (float) 7777]; 23 | } 24 | 25 | return ['result' => 1000, 'premium' => 'false', 'price' => (float) 9.9]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/HandlerCommands/HandlerCommendInterface.php: -------------------------------------------------------------------------------- 1 | login !== 'good_login' && $parameters->password !== 'good_password') { 12 | return ['result' => 27]; 13 | } 14 | 15 | return [ 16 | 'result' => 1000, 17 | 'domains' => [ 18 | [ 19 | 'ext' => 'pl', 20 | 'reg_price' => 9.9, 21 | 'ren_price' => 51.9, 22 | 'tra_price' => 0.0, 23 | 'trd_price' => 0.0, 24 | 'rea_price' => 9.0, 25 | 'dns_price' => 0.0, 26 | 'idprotect' => 'false', 27 | 'idp_price' => '-', 28 | 'renew_offset' => 0, 29 | 'min_reg_period' => 1, 30 | 'tra_renew' => 'undefined', 31 | 'tra_authinfo' => 'undefined', 32 | 'trd_renew' => 'undefined', 33 | 'reactivation_max_days' => 30, 34 | 'require_identity_number' => 'false', 35 | 'require_date_of_birth' => 'false', 36 | 'require_place_of_birth' => 'false', 37 | 'type' => 'C', 38 | 'country_code' => 'PL', 39 | ], 40 | [ 41 | 'ext' => 'com', 42 | 'reg_price' => 49.9, 43 | 'ren_price' => 49.9, 44 | 'tra_price' => 49.9, 45 | 'trd_price' => 0.0, 46 | 'rea_price' => 80.0, 47 | 'dns_price' => 0.0, 48 | 'idprotect' => 'true', 49 | 'idp_price' => 19.9, 50 | 'renew_offset' => 0, 51 | 'min_reg_period' => 1, 52 | 'tra_renew' => 'add1year', 53 | 'tra_authinfo' => 'true', 54 | 'trd_renew' => 'nochange', 55 | 'reactivation_max_days' => 28, 56 | 'require_identity_number' => 'false', 57 | 'require_date_of_birth' => 'false', 58 | 'require_place_of_birth' => 'false', 59 | 'type' => 'G', 60 | 'country_code' => 'xx', 61 | ], 62 | [ 63 | 'ext' => 'com.cn', 64 | 'reg_price' => 149.0, 65 | 'ren_price' => 149.0, 66 | 'tra_price' => 149.0, 67 | 'trd_price' => 79.0, 68 | 'rea_price' => 599.0, 69 | 'dns_price' => 0.0, 70 | 'idprotect' => 'false', 71 | 'idp_price' => '-', 72 | 'renew_offset' => 8, 73 | 'min_reg_period' => 1, 74 | 'tra_renew' => 'add1year', 75 | 'tra_authinfo' => 'true', 76 | 'trd_renew' => 'nochange', 77 | 'reactivation_max_days' => 14, 78 | 'require_identity_number' => 'false', 79 | 'require_date_of_birth' => 'false', 80 | 'require_place_of_birth' => 'false', 81 | 'type' => 'C', 82 | 'country_code' => 'CN', 83 | ], 84 | ], 85 | ]; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Controllers/SoapHandler.php: -------------------------------------------------------------------------------- 1 | getClassName($methodName); 12 | 13 | if (class_exists($className)) { 14 | $handler = new $className(); 15 | 16 | if (method_exists($handler, 'check')) { 17 | if (! (is_array($parameters) && count($parameters) === 1)) { 18 | throw new SoapFault('SOAP-ENV:Client', 'Error cannot find parameter'); 19 | } 20 | 21 | return $handler->check($parameters[0]); 22 | } else { 23 | throw new SoapFault('Server', "Method 'check' not found in $className in API Simulator for DomenyTV module"); 24 | } 25 | } else { 26 | $this->soapFaultCallToUndefinedMethod($methodName); 27 | } 28 | } 29 | 30 | private function getClassName($methodName) 31 | { 32 | return __NAMESPACE__ . '\\HandlerCommands\\' . ucfirst($methodName); 33 | } 34 | 35 | private function soapFaultCallToUndefinedMethod(string $commend): void 36 | { 37 | throw new SoapFault( 38 | 'SOAP-ENV:Server', 39 | 'Uncaught Error: Call to undefined method database::closeConnection() in /home/domeny/app/includes/core/error_handler.php:207 40 | Stack trace: 41 | #0 [internal function]: shutDownFunction() 42 | #1 {main} 43 | thrown', 44 | null, 45 | ' 46 | SOAP-ENV:ServerProcedure ' . $commend . ' not present 48 | 49 | ' 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Requests/AccountBalanceRequest.php: -------------------------------------------------------------------------------- 1 | ['required', 'string'], 20 | 'password' => ['required', 'string'], 21 | ]; 22 | } 23 | 24 | /** 25 | * Determine if the user is authorized to make this request. 26 | */ 27 | public function authorize(): bool 28 | { 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Http/Resources/AccountBalanceResource.php: -------------------------------------------------------------------------------- 1 | accountBalanceResult = $accountBalanceResult; 12 | } 13 | 14 | public function accountBalanceResult() 15 | { 16 | return $this->accountBalanceResult; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Providers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/App/Providers/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Providers/DomenyTvServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerCommands(); 20 | $this->registerCommandSchedules(); 21 | $this->registerTranslations(); 22 | $this->registerConfig(); 23 | $this->registerViews(); 24 | $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations')); 25 | } 26 | 27 | /** 28 | * Register the service provider. 29 | */ 30 | public function register(): void 31 | { 32 | $this->app->register(RouteServiceProvider::class); 33 | } 34 | 35 | /** 36 | * Register commands in the format of Command::class 37 | */ 38 | protected function registerCommands(): void 39 | { 40 | // $this->commands([]); 41 | } 42 | 43 | /** 44 | * Register command Schedules. 45 | */ 46 | protected function registerCommandSchedules(): void 47 | { 48 | // $this->app->booted(function () { 49 | // $schedule = $this->app->make(Schedule::class); 50 | // $schedule->command('inspire')->hourly(); 51 | // }); 52 | } 53 | 54 | /** 55 | * Register translations. 56 | */ 57 | public function registerTranslations(): void 58 | { 59 | $langPath = resource_path('lang/modules/' . $this->moduleNameLower); 60 | 61 | if (is_dir($langPath)) { 62 | $this->loadTranslationsFrom($langPath, $this->moduleNameLower); 63 | $this->loadJsonTranslationsFrom($langPath); 64 | } else { 65 | $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); 66 | $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); 67 | } 68 | } 69 | 70 | /** 71 | * Register config. 72 | */ 73 | protected function registerConfig(): void 74 | { 75 | $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config'); 76 | $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); 77 | } 78 | 79 | /** 80 | * Register views. 81 | */ 82 | public function registerViews(): void 83 | { 84 | $viewPath = resource_path('views/modules/' . $this->moduleNameLower); 85 | $sourcePath = module_path($this->moduleName, 'resources/views'); 86 | 87 | $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']); 88 | 89 | $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); 90 | 91 | $componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . config('modules.paths.generator.component-class.path')); 92 | Blade::componentNamespace($componentNamespace, $this->moduleNameLower); 93 | } 94 | 95 | /** 96 | * Get the services provided by the provider. 97 | */ 98 | public function provides(): array 99 | { 100 | return []; 101 | } 102 | 103 | private function getPublishableViewPaths(): array 104 | { 105 | $paths = []; 106 | foreach (config('view.paths') as $path) { 107 | if (is_dir($path . '/modules/' . $this->moduleNameLower)) { 108 | $paths[] = $path . '/modules/' . $this->moduleNameLower; 109 | } 110 | } 111 | 112 | return $paths; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Modules/DomenyTv/App/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 31 | 32 | $this->mapWebRoutes(); 33 | } 34 | 35 | /** 36 | * Define the "web" routes for the application. 37 | * 38 | * These routes all receive session state, CSRF protection, etc. 39 | */ 40 | protected function mapWebRoutes(): void 41 | { 42 | Route::middleware('web') 43 | ->namespace($this->moduleNamespace) 44 | ->group(module_path('DomenyTv', '/routes/web.php')); 45 | } 46 | 47 | /** 48 | * Define the "api" routes for the application. 49 | * 50 | * These routes are typically stateless. 51 | */ 52 | protected function mapApiRoutes(): void 53 | { 54 | Route::prefix('api') 55 | ->middleware('api') 56 | ->namespace($this->moduleNamespace) 57 | ->group(module_path('DomenyTv', '/routes/api.php')); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Modules/DomenyTv/Database/Seeders/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/Database/Seeders/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/Database/Seeders/DomenyTvDatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call([]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Modules/DomenyTv/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "olsza/domenytv", 3 | "description": "DomenyTV module for API simulator", 4 | "authors": [ 5 | { 6 | "name": "Olsza", 7 | "email": "olsza@users.noreply.github.com" 8 | } 9 | ], 10 | "require": { 11 | "ext-dom": "*", 12 | "ext-http": "*", 13 | "ext-soap": "*", 14 | "symfony/http-foundation": "^6.4", 15 | "php-soap/wsdl": "^1.8", 16 | "php-soap/xml": "^1.6" 17 | }, 18 | "extra": { 19 | "laravel": { 20 | "providers": [], 21 | "aliases": { 22 | 23 | } 24 | } 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "Modules\\DomenyTv\\": "", 29 | "Modules\\DomenyTv\\App\\": "app/", 30 | "Modules\\DomenyTv\\Database\\Factories\\": "database/factories/", 31 | "Modules\\DomenyTv\\Database\\Seeders\\": "database/seeders/" 32 | } 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Modules\\DomenyTv\\Tests\\": "tests/" 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Modules/DomenyTv/config/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/config/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/config/config.php: -------------------------------------------------------------------------------- 1 | 'DomenyTv', 5 | ]; 6 | -------------------------------------------------------------------------------- /Modules/DomenyTv/docs/API2_documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/docs/API2_documentation.pdf -------------------------------------------------------------------------------- /Modules/DomenyTv/docs/API2_dokumentacja.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/docs/API2_dokumentacja.pdf -------------------------------------------------------------------------------- /Modules/DomenyTv/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DomenyTv", 3 | "alias": "domenytv", 4 | "description": "", 5 | "keywords": [], 6 | "priority": 0, 7 | "providers": [ 8 | "Modules\\DomenyTv\\App\\Providers\\DomenyTvServiceProvider" 9 | ], 10 | "files": [] 11 | } 12 | -------------------------------------------------------------------------------- /Modules/DomenyTv/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build" 7 | }, 8 | "devDependencies": { 9 | "axios": "^1.1.2", 10 | "laravel-vite-plugin": "^0.7.5", 11 | "sass": "^1.69.5", 12 | "postcss": "^8.3.7", 13 | "vite": "^4.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Modules/DomenyTv/resources/assets/js/app.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/resources/assets/js/app.js -------------------------------------------------------------------------------- /Modules/DomenyTv/resources/assets/sass/app.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/resources/assets/sass/app.scss -------------------------------------------------------------------------------- /Modules/DomenyTv/resources/views/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/resources/views/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/resources/views/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('domenytv::layouts.master') 2 | 3 | @section('content') 4 |

Hello World

5 | 6 |

Module: {!! config('domenytv.name') !!}

7 | @endsection 8 | -------------------------------------------------------------------------------- /Modules/DomenyTv/resources/views/layouts/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | DomenyTv Module - {{ config('app.name', 'Laravel') }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | {{-- Vite CSS --}} 21 | {{-- {{ module_vite('build-domenytv', 'resources/assets/sass/app.scss') }} --}} 22 | 23 | 24 | 25 | @yield('content') 26 | 27 | {{-- Vite JS --}} 28 | {{-- {{ module_vite('build-domenytv', 'resources/assets/js/app.js') }} --}} 29 | 30 | -------------------------------------------------------------------------------- /Modules/DomenyTv/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/Modules/DomenyTv/routes/.gitkeep -------------------------------------------------------------------------------- /Modules/DomenyTv/routes/api.php: -------------------------------------------------------------------------------- 1 | json(['error' => 'Plik XML nie istnieje.'], 404); 23 | } 24 | 25 | $xmlContent = file_get_contents($filePath); 26 | 27 | return response($xmlContent)->header('Content-Type', 'application/xml'); 28 | }); 29 | -------------------------------------------------------------------------------- /Modules/DomenyTv/routes/web.php: -------------------------------------------------------------------------------- 1 | bodyXml(self::COMMEND, ['login' => 'bad_login', 'password' => 'password']); 12 | 13 | $expectedResponse = $this->codeResponse(self::COMMEND, 27); 14 | 15 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 16 | } 17 | 18 | public function test_good_value_balance() 19 | { 20 | $body = $this->bodyXml(self::COMMEND); 21 | 22 | $expectedResponse = $this->resultResponse(self::COMMEND, ['result' => 1000, 'balance' => '3210.66']); 23 | 24 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/CheckDomainExtendedCommendTest.php: -------------------------------------------------------------------------------- 1 | bodyXml(self::COMMEND, ['login' => 'bad_login', 'password' => 'password', 'domain' => 'domena.pl']); 12 | 13 | $expectedResponse = $this->codeResponse(self::COMMEND, 27); 14 | 15 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 16 | } 17 | 18 | public function testNotAllRequiredDataProvided(): void 19 | { 20 | $body = $this->bodyXml(self::COMMEND); 21 | 22 | $expectedResponse = $this->codeResponse(self::COMMEND, 16); 23 | 24 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 25 | } 26 | 27 | public function testWrongParameterIsEmpty(): void 28 | { 29 | $body = $this->bodyXml(self::COMMEND, ['domain' => '']); 30 | 31 | $expectedResponse = $this->codeResponse(self::COMMEND, 1); 32 | 33 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 34 | } 35 | 36 | public function test_good_value_premium_domain() 37 | { 38 | $body = $this->bodyXml(self::COMMEND, ['domain' => 'olsza.otto']); 39 | 40 | $expectedResponse = $this->resultResponse(self::COMMEND, ['result' => 1000, 'premium' => 'true', 'price' => 7777.0]); 41 | 42 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 43 | } 44 | 45 | public function test_good_value_is_not_premium_domain() 46 | { 47 | $body = $this->bodyXml(self::COMMEND, ['domain' => 'olsza.test']); 48 | 49 | $expectedResponse = $this->resultResponse(self::COMMEND, ['result' => 1000, 'premium' => 'false', 'price' => 9.9]); 50 | 51 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/CheckDomainTest.php: -------------------------------------------------------------------------------- 1 | bodyXml(self::COMMEND, ['login' => 'bad_login', 'password' => 'password', 'domain' => 'domena.pl']); 12 | 13 | $expectedResponse = $this->codeResponse(self::COMMEND, 27); 14 | 15 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 16 | } 17 | 18 | public function test_domain_is_busy() 19 | { 20 | $body = $this->bodyXml(self::COMMEND, ['login' => 'good_login', 'password' => 'good_pass', 'domain' => 'olsza.info']); 21 | 22 | $expectedResponse = $this->codeResponse(self::COMMEND, 9076); 23 | 24 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 25 | } 26 | 27 | public function test_domain_is_free() 28 | { 29 | $body = $this->bodyXml(self::COMMEND, ['login' => 'good_login', 'password' => 'good_pass', 'domain' => 'domain.free']); 30 | 31 | $expectedResponse = $this->codeResponse(self::COMMEND, 1000); 32 | 33 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 34 | } 35 | 36 | public function testNotAllRequiredDataProvided(): void 37 | { 38 | $body = $this->bodyXml(self::COMMEND); 39 | 40 | $expectedResponse = $this->codeResponse(self::COMMEND, 16); 41 | 42 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 43 | } 44 | 45 | public function testWrongParameterIsEmpty(): void 46 | { 47 | $body = $this->bodyXml(self::COMMEND, ['domain' => '']); 48 | 49 | $expectedResponse = $this->codeResponse(self::COMMEND, 1); 50 | 51 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 52 | } 53 | 54 | public function testWrongDomainExtName(): void 55 | { 56 | $body = $this->bodyXml(self::COMMEND, ['domain' => 'domena.x']); 57 | 58 | $expectedResponse = $this->codeResponse(self::COMMEND, 1); 59 | 60 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 61 | } 62 | 63 | public function testDomainIsTooLongOver63Characters(): void 64 | { 65 | $body = $this->bodyXml(self::COMMEND, ['domain' => '123456789a123456789b123456789c123456789d123456789e123456789f123455.de']); 66 | 67 | $expectedResponse = $this->codeResponse(self::COMMEND, 1); 68 | 69 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 70 | } 71 | 72 | public function testDomainIsTooShort(): void 73 | { 74 | $body = $this->bodyXml(self::COMMEND, ['domain' => 'ab.com']); 75 | 76 | $expectedResponse = $this->codeResponse(self::COMMEND, 112); 77 | 78 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/CommonTest.php: -------------------------------------------------------------------------------- 1 | httpClient = new Client(); 23 | } 24 | 25 | public function testNoInputParameter() 26 | { 27 | $body = ' 28 | 29 | 30 | 31 | good_login 32 | good_pass 33 | 34 | 35 | 36 | 37 | '; 38 | 39 | $out = ' 40 | 41 | 42 | 43 | SOAP-ENV:Client 44 | Error cannot find parameter 45 | 46 | 47 | 48 | '; 49 | 50 | $clientMock = $this->createMock(Client::class); 51 | 52 | $clientMock->expects($this->any()) 53 | ->method('post') 54 | ->with(new Uri($this->url)) 55 | ->willReturn(new Response(200, ['Content-Type' => 'text/xml'], $out)); 56 | 57 | $this->setClientMock($clientMock); 58 | 59 | $response = $this->sendUrlPost($body); 60 | 61 | $this->assertXmlStringEqualsXmlString($out, $response->getBody()->getContents()); 62 | } 63 | 64 | public function testMoreInputParameters() 65 | { 66 | $body = ' 67 | 68 | 69 | 70 | good_login 71 | good_pass 72 | 73 | 74 | cos 75 | 76 | 77 | 78 | 79 | '; 80 | 81 | $response = $this->sendUrlPost($body); 82 | 83 | $responseBody = $response->getBody()->getContents(); 84 | 85 | $out = ' 86 | 88 | 89 | 90 | SOAP-ENV:Client 91 | Error cannot find parameter 92 | 93 | 94 | 95 | '; 96 | 97 | $this->assertXmlStringEqualsXmlString($out, $responseBody); 98 | } 99 | 100 | protected function setClientMock($client): void 101 | { 102 | $this->httpClient = $client; 103 | } 104 | 105 | /** 106 | * @throws \GuzzleHttp\Exception\GuzzleException 107 | */ 108 | protected function sendUrlPost(string $body): ResponseInterface 109 | { 110 | return (new Client())->post($this->url, [ 111 | 'headers' => ['Content-Type' => 'text/xml'], 112 | 'body' => $body, 113 | ]); 114 | } 115 | 116 | private function itemsReturn(array $itemsReturn): string 117 | { 118 | $return = ''; 119 | 120 | foreach ($itemsReturn as $key => $value) { 121 | if (is_array($value)) { 122 | $return .= ' 123 | 124 | ' . $key . ' 125 | '; 126 | $return .= '' . $this->itemsReturn($value) . ' 127 | 128 | '; 129 | } else { 130 | $return .= ' 131 | ' . $key . ' 132 | ' . $value . ' 133 | '; 134 | } 135 | } 136 | 137 | return $return; 138 | } 139 | 140 | protected function bodyXml(string $commend, ?array $parameters = []): string 141 | { 142 | if (! isset($parameters['login'])) { 143 | $parameters['login'] = 'good_login'; 144 | } 145 | if (! isset($parameters['password'])) { 146 | $parameters['password'] = 'good_pass'; 147 | } 148 | 149 | $xmlIn = ' 150 | 151 | <' . $commend . '> 152 | '; 153 | foreach ($parameters as $key => $value) { 154 | $xmlIn .= "\n\t\t\t\t\t<$key>$value"; 155 | } 156 | $xmlIn .= ' 157 | 158 | 159 | 160 | '; 161 | 162 | return $xmlIn; 163 | } 164 | 165 | protected function resultResponse(string $nameCommend, array $itemsReturn = []) 166 | { 167 | $return = ' 168 | 175 | 176 | 177 | ' . $this->returnTypeFor($nameCommend, $itemsReturn) . ' 178 | 179 | 180 | '; 181 | 182 | return $return; 183 | } 184 | 185 | protected function codeResponse(string $nameCommend, int $codeResult): string 186 | { 187 | return $this->resultResponse($nameCommend, ['result' => $codeResult]); 188 | } 189 | 190 | protected function resultResponseBody($expectedResponse, $body) 191 | { 192 | $clientMock = $this->createMock(Client::class); 193 | 194 | $clientMock->expects($this->any()) 195 | ->method('post') 196 | ->with(new Uri($this->url)) 197 | ->willReturn(new Response(200, ['Content-Type' => 'text/xml'], $expectedResponse)); 198 | 199 | $this->setClientMock($clientMock); 200 | 201 | $response = $this->sendUrlPost($body); 202 | 203 | return $response->getBody()->getContents(); 204 | } 205 | 206 | private function returnTypeFor(string $nameCommend, array $itemsReturn): string 207 | { 208 | $result = Arr::get($itemsReturn, 'result'); 209 | 210 | return match (true) { 211 | $nameCommend === 'pricelist' && $result === 1000 => $this->returnTypeArgs($itemsReturn), 212 | default => $this->returnTypeReturn($itemsReturn), 213 | }; 214 | } 215 | 216 | private function returnTypeReturn(array $itemsReturn): string 217 | { 218 | $return = ' 219 | '; 220 | $return .= $this->itemsReturn($itemsReturn); 221 | 222 | $return .= ' 223 | '; 224 | 225 | return $return; 226 | } 227 | 228 | private function returnTypeArgs(array $itemsReturn): string 229 | { 230 | $return = ' 231 | '; 232 | $return .= $this->itemsReturn($itemsReturn); 233 | 234 | $return .= ' 235 | '; 236 | 237 | return $return; 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/DomenyTvControllerTest.php: -------------------------------------------------------------------------------- 1 | actingAsUserWithIP('127.0.0.1'); 12 | 13 | $response = $this->post('http://localhost/api/soap', [], ['Content-Type' => 'text/xml']); 14 | 15 | $response->assertHeader('Content-Type', 'text/xml; charset=UTF-8'); 16 | $response->assertNoContent(200); 17 | } 18 | 19 | public function testHandleRequestWithUnauthorizedIP() 20 | { 21 | $this->actingAsUserWithIP('192.168.0.1'); 22 | 23 | $response = $this->post('http://localhost/api/soap', [], ['Content-Type' => 'text/xml']); 24 | 25 | $response->assertHeader('Content-Type', 'text/xml; charset=UTF-8'); 26 | $response->assertSeeText('Unauthorized IP - 192.168.0.1'); 27 | } 28 | 29 | private function actingAsUserWithIP($ip) 30 | { 31 | $server = [ 32 | 'REMOTE_ADDR' => $ip, 33 | ]; 34 | 35 | $this->serverVariables = array_merge($this->serverVariables, $server); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/PricelistCommendTest.php: -------------------------------------------------------------------------------- 1 | bodyXml(self::COMMEND, ['login' => 'bad_login', 'password' => 'password']); 12 | 13 | $expectedResponse = $this->codeResponse(self::COMMEND, 27); 14 | 15 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 16 | } 17 | 18 | public function test_default_result() 19 | { 20 | $body = $this->bodyXml(self::COMMEND, ['login' => 'good_login', 'password' => 'good_password']); 21 | 22 | $expectedResponse = $this->resultResponse(self::COMMEND, [ 23 | 'result' => 1000, 24 | 'domains' => [ 25 | [ 26 | 'ext' => 'pl', 27 | 'reg_price' => 9.9, 28 | 'ren_price' => 51.9, 29 | 'tra_price' => 0.0, 30 | 'trd_price' => 0.0, 31 | 'rea_price' => 9.0, 32 | 'dns_price' => 0.0, 33 | 'idprotect' => 'false', 34 | 'idp_price' => '-', 35 | 'renew_offset' => 0, 36 | 'min_reg_period' => 1, 37 | 'tra_renew' => 'undefined', 38 | 'tra_authinfo' => 'undefined', 39 | 'trd_renew' => 'undefined', 40 | 'reactivation_max_days' => 30, 41 | 'require_identity_number' => 'false', 42 | 'require_date_of_birth' => 'false', 43 | 'require_place_of_birth' => 'false', 44 | 'type' => 'C', 45 | 'country_code' => 'PL', 46 | ], 47 | [ 48 | 'ext' => 'com', 49 | 'reg_price' => 49.9, 50 | 'ren_price' => 49.9, 51 | 'tra_price' => 49.9, 52 | 'trd_price' => 0.0, 53 | 'rea_price' => 80.0, 54 | 'dns_price' => 0.0, 55 | 'idprotect' => 'true', 56 | 'idp_price' => 19.9, 57 | 'renew_offset' => 0, 58 | 'min_reg_period' => 1, 59 | 'tra_renew' => 'add1year', 60 | 'tra_authinfo' => 'true', 61 | 'trd_renew' => 'nochange', 62 | 'reactivation_max_days' => 28, 63 | 'require_identity_number' => 'false', 64 | 'require_date_of_birth' => 'false', 65 | 'require_place_of_birth' => 'false', 66 | 'type' => 'G', 67 | 'country_code' => 'xx', 68 | ], 69 | [ 70 | 'ext' => 'com.cn', 71 | 'reg_price' => 149.0, 72 | 'ren_price' => 149.0, 73 | 'tra_price' => 149.0, 74 | 'trd_price' => 79.0, 75 | 'rea_price' => 599.0, 76 | 'dns_price' => 0.0, 77 | 'idprotect' => 'false', 78 | 'idp_price' => '-', 79 | 'renew_offset' => 8, 80 | 'min_reg_period' => 1, 81 | 'tra_renew' => 'add1year', 82 | 'tra_authinfo' => 'true', 83 | 'trd_renew' => 'nochange', 84 | 'reactivation_max_days' => 14, 85 | 'require_identity_number' => 'false', 86 | 'require_date_of_birth' => 'false', 87 | 'require_place_of_birth' => 'false', 88 | 'type' => 'C', 89 | 'country_code' => 'CN', 90 | ], 91 | ], 92 | ]); 93 | 94 | $expectedResponse = $this->xmlResultCommend(); 95 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 96 | } 97 | 98 | private function xmlResultCommend() 99 | { 100 | return << 102 | 103 | 104 | 105 | 106 | 107 | result 108 | 1000 109 | 110 | 111 | domains 112 | 113 | 114 | 115 | ext 116 | pl 117 | 118 | 119 | reg_price 120 | 9.9 121 | 122 | 123 | ren_price 124 | 51.9 125 | 126 | 127 | tra_price 128 | 0 129 | 130 | 131 | trd_price 132 | 0 133 | 134 | 135 | rea_price 136 | 9 137 | 138 | 139 | dns_price 140 | 0 141 | 142 | 143 | idprotect 144 | false 145 | 146 | 147 | idp_price 148 | - 149 | 150 | 151 | renew_offset 152 | 0 153 | 154 | 155 | min_reg_period 156 | 1 157 | 158 | 159 | tra_renew 160 | undefined 161 | 162 | 163 | tra_authinfo 164 | undefined 165 | 166 | 167 | trd_renew 168 | undefined 169 | 170 | 171 | reactivation_max_days 172 | 30 173 | 174 | 175 | require_identity_number 176 | false 177 | 178 | 179 | require_date_of_birth 180 | false 181 | 182 | 183 | require_place_of_birth 184 | false 185 | 186 | 187 | type 188 | C 189 | 190 | 191 | country_code 192 | PL 193 | 194 | 195 | 196 | 197 | ext 198 | com.cn 199 | 200 | 201 | reg_price 202 | 149 203 | 204 | 205 | ren_price 206 | 149 207 | 208 | 209 | tra_price 210 | 149 211 | 212 | 213 | trd_price 214 | 79 215 | 216 | 217 | rea_price 218 | 599 219 | 220 | 221 | dns_price 222 | 0 223 | 224 | 225 | idprotect 226 | false 227 | 228 | 229 | idp_price 230 | - 231 | 232 | 233 | renew_offset 234 | 8 235 | 236 | 237 | min_reg_period 238 | 1 239 | 240 | 241 | tra_renew 242 | add1year 243 | 244 | 245 | tra_authinfo 246 | true 247 | 248 | 249 | trd_renew 250 | nochange 251 | 252 | 253 | reactivation_max_days 254 | 14 255 | 256 | 257 | require_identity_number 258 | false 259 | 260 | 261 | require_date_of_birth 262 | false 263 | 264 | 265 | require_place_of_birth 266 | false 267 | 268 | 269 | type 270 | C 271 | 272 | 273 | country_code 274 | CN 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | XML; 284 | 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Feature/UniversalCommandTest.php: -------------------------------------------------------------------------------- 1 | bodyXml('wrongCommend'); 10 | 11 | $expectedResponse = ' 12 | 14 | 15 | 16 | SOAP-ENV:Server 17 | Uncaught Error: Call to undefined method database::closeConnection() in /home/domeny/app/includes/core/error_handler.php:207 18 | Stack trace: 19 | #0 [internal function]: shutDownFunction() 20 | #1 {main} 21 | thrown 22 | <?xml version="1.0" encoding="UTF-8"?> 23 | <SOAP-ENV:Envelope 24 | xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Procedure ' . 'wrongCommend' . ' not present</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> 25 | 26 | 27 | 28 | 29 | 30 | '; 31 | 32 | $this->assertXmlStringEqualsXmlString($expectedResponse, $this->resultResponseBody($expectedResponse, $body)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Modules/DomenyTv/tests/Unit/AccountBalanceCommendTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Modules/DomenyTv/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | build: { 6 | outDir: '../../public/build-domenytv', 7 | emptyOutDir: true, 8 | manifest: true, 9 | rollupOptions: { 10 | output: { 11 | copy: [ 12 | { src: __dirname + '/soap.wsdl.xml', dest: '../../public/modules/domenytv' } 13 | ] 14 | } 15 | } 16 | }, 17 | plugins: [ 18 | laravel({ 19 | publicDirectory: '../../public', 20 | buildDirectory: 'build-domenytv', 21 | input: [ 22 | __dirname + '/resources/assets/sass/app.scss', 23 | __dirname + '/resources/assets/js/app.js' 24 | ], 25 | refresh: true, 26 | }), 27 | ], 28 | }); 29 | 30 | //export const paths = [ 31 | // 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss', 32 | // 'Modules/$STUDLY_NAME$/resources/assets/js/app.js', 33 | //]; 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | project logo 3 |

4 | 5 | # API Simulator 6 | 7 | 🇺🇸 API Simulator is a forthcoming project intended to facilitate the local simulation of real APIs without the need for an internet connection. Its primary goal is to empower developers to control responses and data through a planned panel. 8 | 9 | 🇵🇱 API Simulator czyli symulator API to nadchodzący projekt mający na celu ułatwienie lokalnej symulacji prawdziwych interfejsów API bez konieczności połączenia z Internetem. Jego głównym celem jest umożliwienie programistom kontrolowania odpowiedzi i danych za pośrednictwem planowanego panelu. 10 | 11 | 12 | ## 🇺🇸 Project Description / 🇵🇱 Opis projektu 13 | 14 | 🇺🇸 "API Simulator" (or APIs for short) is envisioned as a solution for simulating APIs locally, without relying on internet connectivity. While some entities offer the option to test their APIs on a testing server, many other providers do not. APIs will enable developers to simulate API behavior locally, potentially utilizing Docker for deployment. 15 | 16 | The project will feature a planned panel where users can configure desired responses. This feature will empower developers to define parameters for testing purposes, eliminating the need to connect to a testing server. 17 | 18 | APIs was written as part of the [100 commits](https://100commitow.pl/) challenge organized by [DevMentors](https://github.com/devmentors). 19 | Courtesy of [Domeny.Tv (Domains)](https://domeny.tv) (one of the many commercial API vendors I've had the pleasure to work with, who in my opinion have the best produced [API EN](https://www.domeny.tv/files/API2_documentation.pdf) documentation). 20 | The first module for API Simulator will be created based on their documentation only. 21 | 22 | Future plans for this Open Source project include adding modules for simulating APIs from various providers. 23 | 24 | [To Do List](TODO.md) 25 | 26 | 🇵🇱 "API Simulator" (lub w skrócie APIs) zostanie stworzony jako rozwiązanie do lokalnego symulowania interfejsów API, bez konieczności korzystania z internetu. Podczas gdy niektóre firmy mogą oferować możliwość testowania swoich interfejsów API na serwerze testowym, wielu innych dostawców tego nie zapewniają. APIs będzie umożliwiać deweloperom symulowanie zachowania API lokalnie, a do jego wdrożenia można potencjalnie wykorzystać Docker. 27 | 28 | Projekt będzie zawierał planowany panel, w którym użytkownicy będą mogli skonfigurować pożądane odpowiedzi. Ta funkcjonalność umożliwi programistom definiowanie parametrów testowych, eliminując potrzebę łączenia się z serwerem testowym. 29 | 30 | APIs był pisany w ramach wyzwania [100 commitów](https://100commitow.pl/) organizowany przez [DevMentors](https://github.com/devmentors). 31 | Dzięki uprzejmości [Domeny.Tv](https://domeny.tv) (jeden z wielu dostawców API komercyjnych, z którymi miałem przyjemność współpracować, a którzy według mnie mają najlepiej stworzoną dokumentację [API PL](https://www.domeny.tv/files/API2_dokumentacja.pdf)). 32 | Pierwszy moduł dla API Simulator będzie tworzony właśnie na podstawie ich dokumentacji. 33 | 34 | Plany na przyszłość dla tego projektu Open Source obejmują dodanie modułów do symulowania interfejsów API od różnych dostawców. 35 | 36 | [Lista do zrobienia](TODO.md) 37 | 38 | ## 🇺🇸 Contributing / 🇵🇱 Wnieś swój wkład 39 | 40 | 🇺🇸 Contributions to APIs are anticipated and welcomed! Whether it involves adding new features, fixing bugs, or enhancing documentation, your contributions will enhance the project for all. 41 | 42 | 🇵🇱 Wkład w projekt APIs jest mile widziany i oczekiwany! Niezależnie od tego, czy chodzi o dodawanie nowych funkcji, naprawianie błędów czy ulepszanie dokumentacji, Twój wkład poprawi projekt dla wszystkich. 43 | 44 | ## 🇺🇸 License / 🇵🇱 Licencja 45 | 46 | 🇺🇸 API Simulator is intended to be licensed under the MIT License. Refer to the [LICENSE](LICENSE) file for details. 47 | 48 | 🇵🇱 API Simulator jest na licencji MIT. Szczegółowe informacje można znaleźć w pliku [LICENSE](LICENSE). 49 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | ### 🇺🇸 ToDo / 🇵🇱 Do zrobienia 2 | 3 | 🇺🇸 As part of the `#100commitow` challenge, a prototype of a simulator API for registering domains from [Domeny.tv](https://www.domeny.tv) will be created. 4 | The prototype will return responses for commands: 5 | 6 | 🇵🇱 W ramach wyzwania `#100commitow` zostanie utworzony prototyp API symulatora do rejestrowania domen od [Domeny.tv](https://www.domeny.tv). 7 | Prototyp będzie zwracał odpowiedzi dla komend: 8 | 9 | - [x] `checkDomain` (1) - 🇺🇸 Checks single domain name availability. / 🇵🇱 Sprawdza dostępność pojedynczej nazwy domeny. 10 | - [x] `checkDomainExtended` (2) - 🇺🇸 Checks premium domain names. / 🇵🇱 Sprawdza dostępność domen premium i podaje ich cenę. 11 | - [x] `accountBalance` (4) - 🇺🇸 Returns your current account balance. / 🇵🇱 Sprawdza saldo konta. 12 | - [ ] `domainInfo` (7) - 🇺🇸 Returns detailed information about a domain name. / 🇵🇱 Zwraca szczegółowe informacje o domenie. 13 | - [x] `getPrice` (27) - 🇺🇸 Returns price of registration, renewal, cession and transfer for specified domain extension 14 | (TLD). / 🇵🇱 Zwraca cenę rejestracji na 1 rok, przedłużenia na 1 rok, cesji oraz transferu domeny w wybranym rozszerzeniu. 15 | - [ ] `pricelist` (42) - 🇺🇸 Returns prices of all available TLDs. WARNING! Those are the final prices including all of 16 | the discounts and promos. / 🇵🇱 Zwraca ceny wszystkich dostępnych rozszerzeń domenowych dostępnych do rejestracji. 17 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__ . '/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $dontFlash = [ 16 | 'current_password', 17 | 'password', 18 | 'password_confirmation', 19 | ]; 20 | 21 | /** 22 | * Register the exception handling callbacks for the application. 23 | */ 24 | public function register(): void 25 | { 26 | $this->reportable(function (Throwable $e) { 27 | // 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's middleware aliases. 50 | * 51 | * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. 52 | * 53 | * @var array 54 | */ 55 | protected $middlewareAliases = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 64 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson() ? null : route('login'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts(): array 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | protected $fillable = [ 23 | 'name', 24 | 'email', 25 | 'password', 26 | ]; 27 | 28 | /** 29 | * The attributes that should be hidden for serialization. 30 | * 31 | * @var array 32 | */ 33 | protected $hidden = [ 34 | 'password', 35 | 'remember_token', 36 | ]; 37 | 38 | /** 39 | * The attributes that should be cast. 40 | * 41 | * @var array 42 | */ 43 | protected $casts = [ 44 | 'email_verified_at' => 'datetime', 45 | 'password' => 'hashed', 46 | ]; 47 | } 48 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | */ 22 | public function boot(): void 23 | { 24 | // 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Determine if events and listeners should be automatically discovered. 33 | */ 34 | public function shouldDiscoverEvents(): bool 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | by($request->user()?->id ?: $request->ip()); 29 | }); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "olsza/api-simulator", 3 | "type": "project", 4 | "description": "API Simulator is designed to simulate real APIs locally without requiring an Internet connection. Its main purpose is to allow developers to control responses and data through a panel.", 5 | "keywords": [ 6 | "API", 7 | "simulator", 8 | "API simulator", 9 | "APIs", 10 | "laravel", 11 | "olsza" 12 | ], 13 | "license": "MIT", 14 | "require": { 15 | "php": "^8.1", 16 | "guzzlehttp/guzzle": "^7.8", 17 | "laravel/framework": "^10.10", 18 | "laravel/sanctum": "^3.3", 19 | "laravel/tinker": "^2.8", 20 | "nwidart/laravel-modules": "^10.0" 21 | }, 22 | "require-dev": { 23 | "fakerphp/faker": "^1.9.1", 24 | "laravel/pint": "^1.0", 25 | "laravel/sail": "^1.18", 26 | "mockery/mockery": "^1.4.4", 27 | "nunomaduro/collision": "^7.0", 28 | "phpunit/phpunit": "^10.1", 29 | "spatie/laravel-ignition": "^2.0" 30 | }, 31 | "autoload": { 32 | "psr-4": { 33 | "App\\": "app/", 34 | "Modules\\": "Modules/", 35 | "Database\\Factories\\": "database/factories/", 36 | "Database\\Seeders\\": "database/seeders/" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { 41 | "Tests\\": "tests/" 42 | } 43 | }, 44 | "scripts": { 45 | "post-autoload-dump": [ 46 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 47 | "@php artisan package:discover --ansi" 48 | ], 49 | "post-update-cmd": [ 50 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 51 | ], 52 | "post-root-package-install": [ 53 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 54 | ], 55 | "post-create-project-cmd": [ 56 | "@php artisan key:generate --ansi" 57 | ] 58 | }, 59 | "extra": { 60 | "laravel": { 61 | "dont-discover": [] 62 | } 63 | }, 64 | "config": { 65 | "optimize-autoloader": true, 66 | "preferred-install": "dist", 67 | "sort-packages": true, 68 | "allow-plugins": { 69 | "pestphp/pest-plugin": true, 70 | "php-http/discovery": true 71 | } 72 | }, 73 | "minimum-stability": "stable", 74 | "prefer-stable": true 75 | } 76 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'API simulator'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Application Environment 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This value determines the "environment" your application is currently 27 | | running in. This may determine how you prefer to configure various 28 | | services the application utilizes. Set this in your ".env" file. 29 | | 30 | */ 31 | 32 | 'env' => env('APP_ENV', 'production'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Application Debug Mode 37 | |-------------------------------------------------------------------------- 38 | | 39 | | When your application is in debug mode, detailed error messages with 40 | | stack traces will be shown on every error that occurs within your 41 | | application. If disabled, a simple generic error page is shown. 42 | | 43 | */ 44 | 45 | 'debug' => (bool) env('APP_DEBUG', false), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Application URL 50 | |-------------------------------------------------------------------------- 51 | | 52 | | This URL is used by the console to properly generate URLs when using 53 | | the Artisan command line tool. You should set this to the root of 54 | | your application so that it is used when running Artisan tasks. 55 | | 56 | */ 57 | 58 | 'url' => env('APP_URL', 'http://localhost'), 59 | 60 | 'asset_url' => env('ASSET_URL'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Application Timezone 65 | |-------------------------------------------------------------------------- 66 | | 67 | | Here you may specify the default timezone for your application, which 68 | | will be used by the PHP date and date-time functions. We have gone 69 | | ahead and set this to a sensible default for you out of the box. 70 | | 71 | */ 72 | 73 | 'timezone' => 'Europe/Warsaw', 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Application Locale Configuration 78 | |-------------------------------------------------------------------------- 79 | | 80 | | The application locale determines the default locale that will be used 81 | | by the translation service provider. You are free to set this value 82 | | to any of the locales which will be supported by the application. 83 | | 84 | */ 85 | 86 | 'locale' => 'en', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Application Fallback Locale 91 | |-------------------------------------------------------------------------- 92 | | 93 | | The fallback locale determines the locale to use when the current one 94 | | is not available. You may change the value to correspond to any of 95 | | the language folders that are provided through your application. 96 | | 97 | */ 98 | 99 | 'fallback_locale' => 'en', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Faker Locale 104 | |-------------------------------------------------------------------------- 105 | | 106 | | This locale will be used by the Faker PHP library when generating fake 107 | | data for your database seeds. For example, this will be used to get 108 | | localized telephone numbers, street address information and more. 109 | | 110 | */ 111 | 112 | 'faker_locale' => 'en_US', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Encryption Key 117 | |-------------------------------------------------------------------------- 118 | | 119 | | This key is used by the Illuminate encrypter service and should be set 120 | | to a random, 32 character string, otherwise these encrypted strings 121 | | will not be safe. Please do this before deploying an application! 122 | | 123 | */ 124 | 125 | 'key' => env('APP_KEY'), 126 | 127 | 'cipher' => 'AES-256-CBC', 128 | 129 | /* 130 | |-------------------------------------------------------------------------- 131 | | Maintenance Mode Driver 132 | |-------------------------------------------------------------------------- 133 | | 134 | | These configuration options determine the driver used to determine and 135 | | manage Laravel's "maintenance mode" status. The "cache" driver will 136 | | allow maintenance mode to be controlled across multiple machines. 137 | | 138 | | Supported drivers: "file", "cache" 139 | | 140 | */ 141 | 142 | 'maintenance' => [ 143 | 'driver' => 'file', 144 | // 'store' => 'redis', 145 | ], 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Autoloaded Service Providers 150 | |-------------------------------------------------------------------------- 151 | | 152 | | The service providers listed here will be automatically loaded on the 153 | | request to your application. Feel free to add your own services to 154 | | this array to grant expanded functionality to your applications. 155 | | 156 | */ 157 | 158 | 'providers' => ServiceProvider::defaultProviders()->merge([ 159 | /* 160 | * Package Service Providers... 161 | */ 162 | 163 | /* 164 | * Application Service Providers... 165 | */ 166 | App\Providers\AppServiceProvider::class, 167 | App\Providers\AuthServiceProvider::class, 168 | // App\Providers\BroadcastServiceProvider::class, 169 | App\Providers\EventServiceProvider::class, 170 | App\Providers\RouteServiceProvider::class, 171 | ])->toArray(), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | Class Aliases 176 | |-------------------------------------------------------------------------- 177 | | 178 | | This array of class aliases will be registered when this application 179 | | is started. However, feel free to register as many as you wish as 180 | | the aliases are "lazy" loaded so they don't hinder performance. 181 | | 182 | */ 183 | 184 | 'aliases' => Facade::defaultAliases()->merge([ 185 | // 'Example' => App\Facades\Example::class, 186 | ])->toArray(), 187 | 188 | ]; 189 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expiry time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | | The throttle setting is the number of seconds a user must wait before 88 | | generating more password reset tokens. This prevents the user from 89 | | quickly generating a very large amount of password reset tokens. 90 | | 91 | */ 92 | 93 | 'passwords' => [ 94 | 'users' => [ 95 | 'provider' => 'users', 96 | 'table' => 'password_reset_tokens', 97 | 'expire' => 60, 98 | 'throttle' => 60, 99 | ], 100 | ], 101 | 102 | /* 103 | |-------------------------------------------------------------------------- 104 | | Password Confirmation Timeout 105 | |-------------------------------------------------------------------------- 106 | | 107 | | Here you may define the amount of seconds before a password confirmation 108 | | times out and the user is prompted to re-enter their password via the 109 | | confirmation screen. By default, the timeout lasts for three hours. 110 | | 111 | */ 112 | 113 | 'password_timeout' => 10800, 114 | 115 | ]; 116 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', 41 | 'port' => env('PUSHER_PORT', 443), 42 | 'scheme' => env('PUSHER_SCHEME', 'https'), 43 | 'encrypted' => true, 44 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 45 | ], 46 | 'client_options' => [ 47 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 48 | ], 49 | ], 50 | 51 | 'ably' => [ 52 | 'driver' => 'ably', 53 | 'key' => env('ABLY_KEY'), 54 | ], 55 | 56 | 'redis' => [ 57 | 'driver' => 'redis', 58 | 'connection' => 'default', 59 | ], 60 | 61 | 'log' => [ 62 | 'driver' => 'log', 63 | ], 64 | 65 | 'null' => [ 66 | 'driver' => 'null', 67 | ], 68 | 69 | ], 70 | 71 | ]; 72 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | 'lock_path' => storage_path('framework/cache/data'), 56 | ], 57 | 58 | 'memcached' => [ 59 | 'driver' => 'memcached', 60 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 61 | 'sasl' => [ 62 | env('MEMCACHED_USERNAME'), 63 | env('MEMCACHED_PASSWORD'), 64 | ], 65 | 'options' => [ 66 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 67 | ], 68 | 'servers' => [ 69 | [ 70 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 71 | 'port' => env('MEMCACHED_PORT', 11211), 72 | 'weight' => 100, 73 | ], 74 | ], 75 | ], 76 | 77 | 'redis' => [ 78 | 'driver' => 'redis', 79 | 'connection' => 'cache', 80 | 'lock_connection' => 'default', 81 | ], 82 | 83 | 'dynamodb' => [ 84 | 'driver' => 'dynamodb', 85 | 'key' => env('AWS_ACCESS_KEY_ID'), 86 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 87 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 88 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 89 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 90 | ], 91 | 92 | 'octane' => [ 93 | 'driver' => 'octane', 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Cache Key Prefix 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 104 | | stores there might be other applications using the same cache. For 105 | | that reason, you may prefix every cache key to avoid collisions. 106 | | 107 | */ 108 | 109 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL') . '/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 12), 33 | 'verify' => true, 34 | ], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Argon Options 39 | |-------------------------------------------------------------------------- 40 | | 41 | | Here you may specify the configuration options that should be used when 42 | | passwords are hashed using the Argon algorithm. These will allow you 43 | | to control the amount of time it takes to hash the given password. 44 | | 45 | */ 46 | 47 | 'argon' => [ 48 | 'memory' => 65536, 49 | 'threads' => 1, 50 | 'time' => 4, 51 | 'verify' => true, 52 | ], 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Deprecations Log Channel 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This option controls the log channel that should be used to log warnings 29 | | regarding deprecated PHP and library features. This allows you to get 30 | | your application ready for upcoming major versions of dependencies. 31 | | 32 | */ 33 | 34 | 'deprecations' => [ 35 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 36 | 'trace' => false, 37 | ], 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Log Channels 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Here you may configure the log channels for your application. Out of 45 | | the box, Laravel uses the Monolog PHP logging library. This gives 46 | | you a variety of powerful log handlers / formatters to utilize. 47 | | 48 | | Available Drivers: "single", "daily", "slack", "syslog", 49 | | "errorlog", "monolog", 50 | | "custom", "stack" 51 | | 52 | */ 53 | 54 | 'channels' => [ 55 | 'stack' => [ 56 | 'driver' => 'stack', 57 | 'channels' => ['single'], 58 | 'ignore_exceptions' => false, 59 | ], 60 | 61 | 'single' => [ 62 | 'driver' => 'single', 63 | 'path' => storage_path('logs/laravel.log'), 64 | 'level' => env('LOG_LEVEL', 'debug'), 65 | 'replace_placeholders' => true, 66 | ], 67 | 68 | 'daily' => [ 69 | 'driver' => 'daily', 70 | 'path' => storage_path('logs/laravel.log'), 71 | 'level' => env('LOG_LEVEL', 'debug'), 72 | 'days' => 14, 73 | 'replace_placeholders' => true, 74 | ], 75 | 76 | 'slack' => [ 77 | 'driver' => 'slack', 78 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 79 | 'username' => 'Laravel Log', 80 | 'emoji' => ':boom:', 81 | 'level' => env('LOG_LEVEL', 'critical'), 82 | 'replace_placeholders' => true, 83 | ], 84 | 85 | 'papertrail' => [ 86 | 'driver' => 'monolog', 87 | 'level' => env('LOG_LEVEL', 'debug'), 88 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 89 | 'handler_with' => [ 90 | 'host' => env('PAPERTRAIL_URL'), 91 | 'port' => env('PAPERTRAIL_PORT'), 92 | 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), 93 | ], 94 | 'processors' => [PsrLogMessageProcessor::class], 95 | ], 96 | 97 | 'stderr' => [ 98 | 'driver' => 'monolog', 99 | 'level' => env('LOG_LEVEL', 'debug'), 100 | 'handler' => StreamHandler::class, 101 | 'formatter' => env('LOG_STDERR_FORMATTER'), 102 | 'with' => [ 103 | 'stream' => 'php://stderr', 104 | ], 105 | 'processors' => [PsrLogMessageProcessor::class], 106 | ], 107 | 108 | 'syslog' => [ 109 | 'driver' => 'syslog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | 'facility' => LOG_USER, 112 | 'replace_placeholders' => true, 113 | ], 114 | 115 | 'errorlog' => [ 116 | 'driver' => 'errorlog', 117 | 'level' => env('LOG_LEVEL', 'debug'), 118 | 'replace_placeholders' => true, 119 | ], 120 | 121 | 'null' => [ 122 | 'driver' => 'monolog', 123 | 'handler' => NullHandler::class, 124 | ], 125 | 126 | 'emergency' => [ 127 | 'path' => storage_path('logs/laravel.log'), 128 | ], 129 | ], 130 | 131 | ]; 132 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 32 | | "postmark", "log", "array", "failover", "roundrobin" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'url' => env('MAIL_URL'), 40 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 41 | 'port' => env('MAIL_PORT', 587), 42 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 43 | 'username' => env('MAIL_USERNAME'), 44 | 'password' => env('MAIL_PASSWORD'), 45 | 'timeout' => null, 46 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 47 | ], 48 | 49 | 'ses' => [ 50 | 'transport' => 'ses', 51 | ], 52 | 53 | 'postmark' => [ 54 | 'transport' => 'postmark', 55 | // 'message_stream_id' => null, 56 | // 'client' => [ 57 | // 'timeout' => 5, 58 | // ], 59 | ], 60 | 61 | 'mailgun' => [ 62 | 'transport' => 'mailgun', 63 | // 'client' => [ 64 | // 'timeout' => 5, 65 | // ], 66 | ], 67 | 68 | 'sendmail' => [ 69 | 'transport' => 'sendmail', 70 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 71 | ], 72 | 73 | 'log' => [ 74 | 'transport' => 'log', 75 | 'channel' => env('MAIL_LOG_CHANNEL'), 76 | ], 77 | 78 | 'array' => [ 79 | 'transport' => 'array', 80 | ], 81 | 82 | 'failover' => [ 83 | 'transport' => 'failover', 84 | 'mailers' => [ 85 | 'smtp', 86 | 'log', 87 | ], 88 | ], 89 | 90 | 'roundrobin' => [ 91 | 'transport' => 'roundrobin', 92 | 'mailers' => [ 93 | 'ses', 94 | 'postmark', 95 | ], 96 | ], 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Global "From" Address 102 | |-------------------------------------------------------------------------- 103 | | 104 | | You may wish for all e-mails sent by your application to be sent from 105 | | the same address. Here, you may specify a name and address that is 106 | | used globally for all e-mails that are sent by your application. 107 | | 108 | */ 109 | 110 | 'from' => [ 111 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 112 | 'name' => env('MAIL_FROM_NAME', 'Example'), 113 | ], 114 | 115 | /* 116 | |-------------------------------------------------------------------------- 117 | | Markdown Mail Settings 118 | |-------------------------------------------------------------------------- 119 | | 120 | | If you are using Markdown based email rendering, you may configure your 121 | | theme and component paths here, allowing you to customize the design 122 | | of the emails. Or, you may simply stick with the Laravel defaults! 123 | | 124 | */ 125 | 126 | 'markdown' => [ 127 | 'theme' => 'default', 128 | 129 | 'paths' => [ 130 | resource_path('views/vendor/mail'), 131 | ], 132 | ], 133 | 134 | ]; 135 | -------------------------------------------------------------------------------- /config/modules.php: -------------------------------------------------------------------------------- 1 | 'Modules', 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | Module Stubs 22 | |-------------------------------------------------------------------------- 23 | | 24 | | Default module stubs. 25 | | 26 | */ 27 | 28 | 'stubs' => [ 29 | 'enabled' => false, 30 | 'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'), 31 | 'files' => [ 32 | 'routes/web' => 'routes/web.php', 33 | 'routes/api' => 'routes/api.php', 34 | 'views/index' => 'resources/views/index.blade.php', 35 | 'views/master' => 'resources/views/layouts/master.blade.php', 36 | 'scaffold/config' => 'config/config.php', 37 | 'composer' => 'composer.json', 38 | 'assets/js/app' => 'resources/assets/js/app.js', 39 | 'assets/sass/app' => 'resources/assets/sass/app.scss', 40 | 'vite' => 'vite.config.js', 41 | 'package' => 'package.json', 42 | ], 43 | 'replacements' => [ 44 | 'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'], 45 | 'routes/api' => ['LOWER_NAME', 'STUDLY_NAME'], 46 | 'vite' => ['LOWER_NAME'], 47 | 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'], 48 | 'views/index' => ['LOWER_NAME'], 49 | 'views/master' => ['LOWER_NAME', 'STUDLY_NAME'], 50 | 'scaffold/config' => ['STUDLY_NAME'], 51 | 'composer' => [ 52 | 'LOWER_NAME', 53 | 'STUDLY_NAME', 54 | 'VENDOR', 55 | 'AUTHOR_NAME', 56 | 'AUTHOR_EMAIL', 57 | 'MODULE_NAMESPACE', 58 | 'PROVIDER_NAMESPACE', 59 | ], 60 | ], 61 | 'gitkeep' => true, 62 | ], 63 | 'paths' => [ 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Modules path 67 | |-------------------------------------------------------------------------- 68 | | 69 | | This path is used to save the generated module. 70 | | This path will also be added automatically to the list of scanned folders. 71 | | 72 | */ 73 | 74 | 'modules' => base_path('Modules'), 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Modules assets path 78 | |-------------------------------------------------------------------------- 79 | | 80 | | Here you may update the modules' assets path. 81 | | 82 | */ 83 | 84 | 'assets' => public_path('modules'), 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | The migrations' path 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Where you run the 'module:publish-migration' command, where do you publish the 91 | | the migration files? 92 | | 93 | */ 94 | 95 | 'migration' => base_path('database/migrations'), 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Generator path 99 | |-------------------------------------------------------------------------- 100 | | Customise the paths where the folders will be generated. 101 | | Setting the generate key to false will not generate that folder 102 | */ 103 | 'generator' => [ 104 | 'config' => ['path' => 'config', 'generate' => true], 105 | 'command' => ['path' => 'App/Console', 'generate' => false], 106 | 'channels' => ['path' => 'App/Broadcasting', 'generate' => false], 107 | 'migration' => ['path' => 'Database/migrations', 'generate' => false], 108 | 'seeder' => ['path' => 'Database/Seeders', 'generate' => true], 109 | 'factory' => ['path' => 'Database/Factories', 'generate' => false], 110 | 'model' => ['path' => 'App/Models', 'generate' => false], 111 | 'observer' => ['path' => 'App/Observers', 'generate' => false], 112 | 'routes' => ['path' => 'routes', 'generate' => true], 113 | 'controller' => ['path' => 'App/Http/Controllers', 'generate' => true], 114 | 'filter' => ['path' => 'App/Http/Middleware', 'generate' => false], 115 | 'request' => ['path' => 'App/Http/Requests', 'generate' => false], 116 | 'provider' => ['path' => 'App/Providers', 'generate' => true], 117 | 'assets' => ['path' => 'resources/assets', 'generate' => false], 118 | 'lang' => ['path' => 'lang', 'generate' => false], 119 | 'views' => ['path' => 'resources/views', 'generate' => true], 120 | 'test' => ['path' => 'tests/Unit', 'generate' => false], 121 | 'test-feature' => ['path' => 'tests/Feature', 'generate' => false], 122 | 'repository' => ['path' => 'App/Repositories', 'generate' => false], 123 | 'event' => ['path' => 'App/Events', 'generate' => false], 124 | 'listener' => ['path' => 'App/Listeners', 'generate' => false], 125 | 'policies' => ['path' => 'App/Policies', 'generate' => false], 126 | 'rules' => ['path' => 'App/Rules', 'generate' => false], 127 | 'jobs' => ['path' => 'App/Jobs', 'generate' => false], 128 | 'emails' => ['path' => 'App/Emails', 'generate' => false], 129 | 'notifications' => ['path' => 'App/Notifications', 'generate' => false], 130 | 'resource' => ['path' => 'App/resources', 'generate' => false], 131 | 'component-view' => ['path' => 'resources/views/components', 'generate' => false], 132 | 'component-class' => ['path' => 'App/View/Components', 'generate' => false], 133 | ], 134 | ], 135 | 136 | /* 137 | |-------------------------------------------------------------------------- 138 | | Package commands 139 | |-------------------------------------------------------------------------- 140 | | 141 | | Here you can define which commands will be visible and used in your 142 | | application. You can add your own commands to merge section. 143 | | 144 | */ 145 | 'commands' => ConsoleServiceProvider::defaultCommands() 146 | ->merge([ 147 | // New commands go here 148 | ])->toArray(), 149 | 150 | /* 151 | |-------------------------------------------------------------------------- 152 | | Scan Path 153 | |-------------------------------------------------------------------------- 154 | | 155 | | Here you define which folder will be scanned. By default will scan vendor 156 | | directory. This is useful if you host the package in packagist website. 157 | | 158 | */ 159 | 160 | 'scan' => [ 161 | 'enabled' => false, 162 | 'paths' => [ 163 | base_path('vendor/*/*'), 164 | ], 165 | ], 166 | /* 167 | |-------------------------------------------------------------------------- 168 | | Composer File Template 169 | |-------------------------------------------------------------------------- 170 | | 171 | | Here is the config for the composer.json file, generated by this package 172 | | 173 | */ 174 | 175 | 'composer' => [ 176 | 'vendor' => 'olsza', 177 | 'author' => [ 178 | 'name' => 'Olsza', 179 | 'email' => 'olsza@users.noreply.github.com', 180 | ], 181 | 'composer-output' => false, 182 | ], 183 | 184 | /* 185 | |-------------------------------------------------------------------------- 186 | | Caching 187 | |-------------------------------------------------------------------------- 188 | | 189 | | Here is the config for setting up the caching feature. 190 | | 191 | */ 192 | 'cache' => [ 193 | 'enabled' => false, 194 | 'driver' => 'file', 195 | 'key' => 'laravel-modules', 196 | 'lifetime' => 60, 197 | ], 198 | /* 199 | |-------------------------------------------------------------------------- 200 | | Choose what laravel-modules will register as custom namespaces. 201 | | Setting one to false will require you to register that part 202 | | in your own Service Provider class. 203 | |-------------------------------------------------------------------------- 204 | */ 205 | 'register' => [ 206 | 'translations' => true, 207 | /** 208 | * load files on boot or register method 209 | */ 210 | 'files' => 'register', 211 | ], 212 | 213 | /* 214 | |-------------------------------------------------------------------------- 215 | | Activators 216 | |-------------------------------------------------------------------------- 217 | | 218 | | You can define new types of activators here, file, database, etc. The only 219 | | required parameter is 'class'. 220 | | The file activator will store the activation status in storage/installed_modules 221 | */ 222 | 'activators' => [ 223 | 'file' => [ 224 | 'class' => FileActivator::class, 225 | 'statuses-file' => base_path('modules_statuses.json'), 226 | 'cache-key' => 'activator.installed', 227 | 'cache-lifetime' => 604800, 228 | ], 229 | ], 230 | 231 | 'activator' => 'file', 232 | ]; 233 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Job Batching 79 | |-------------------------------------------------------------------------- 80 | | 81 | | The following options configure the database and table that store job 82 | | batching information. These options can be updated to any database 83 | | connection and table which has been defined by your application. 84 | | 85 | */ 86 | 87 | 'batching' => [ 88 | 'database' => env('DB_CONNECTION', 'mysql'), 89 | 'table' => 'job_batches', 90 | ], 91 | 92 | /* 93 | |-------------------------------------------------------------------------- 94 | | Failed Queue Jobs 95 | |-------------------------------------------------------------------------- 96 | | 97 | | These options configure the behavior of failed queue job logging so you 98 | | can control which database and table are used to store the jobs that 99 | | have failed. You may change them to any database / table you wish. 100 | | 101 | */ 102 | 103 | 'failed' => [ 104 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 105 | 'database' => env('DB_CONNECTION', 'mysql'), 106 | 'table' => 'failed_jobs', 107 | ], 108 | 109 | ]; 110 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. This will override any values set in the token's 45 | | "expires_at" attribute, but first-party sessions are not affected. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Token Prefix 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Sanctum can prefix new tokens in order to take advantage of numerous 57 | | security scanning initiatives maintained by open source platforms 58 | | that notify developers if they commit tokens into repositories. 59 | | 60 | | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning 61 | | 62 | */ 63 | 64 | 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Sanctum Middleware 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When authenticating your first-party SPA with Sanctum you may need to 72 | | customize some of the middleware Sanctum uses while processing the 73 | | request. You may change the middleware listed below as required. 74 | | 75 | */ 76 | 77 | 'middleware' => [ 78 | 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 79 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 80 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 81 | ], 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Session Lifetime 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may specify the number of minutes that you wish the session 29 | | to be allowed to remain idle before it expires. If you want them 30 | | to immediately expire on the browser closing, set that option. 31 | | 32 | */ 33 | 34 | 'lifetime' => env('SESSION_LIFETIME', 120), 35 | 36 | 'expire_on_close' => false, 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Session Encryption 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This option allows you to easily specify that all of your session data 44 | | should be encrypted before it is stored. All encryption will be run 45 | | automatically by Laravel and you can use the Session like normal. 46 | | 47 | */ 48 | 49 | 'encrypt' => false, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session File Location 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When using the native session driver, we need a location where session 57 | | files may be stored. A default has been set for you but a different 58 | | location may be specified. This is only needed for file sessions. 59 | | 60 | */ 61 | 62 | 'files' => storage_path('framework/sessions'), 63 | 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Session Database Connection 67 | |-------------------------------------------------------------------------- 68 | | 69 | | When using the "database" or "redis" session drivers, you may specify a 70 | | connection that should be used to manage these sessions. This should 71 | | correspond to a connection in your database configuration options. 72 | | 73 | */ 74 | 75 | 'connection' => env('SESSION_CONNECTION'), 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Session Database Table 80 | |-------------------------------------------------------------------------- 81 | | 82 | | When using the "database" session driver, you may specify the table we 83 | | should use to manage the sessions. Of course, a sensible default is 84 | | provided for you; however, you are free to change this as needed. 85 | | 86 | */ 87 | 88 | 'table' => 'sessions', 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Session Cache Store 93 | |-------------------------------------------------------------------------- 94 | | 95 | | While using one of the framework's cache driven session backends you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | | Affects: "apc", "dynamodb", "memcached", "redis" 100 | | 101 | */ 102 | 103 | 'store' => env('SESSION_STORE'), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Session Sweeping Lottery 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Some session drivers must manually sweep their storage location to get 111 | | rid of old sessions from storage. Here are the chances that it will 112 | | happen on a given request. By default, the odds are 2 out of 100. 113 | | 114 | */ 115 | 116 | 'lottery' => [2, 100], 117 | 118 | /* 119 | |-------------------------------------------------------------------------- 120 | | Session Cookie Name 121 | |-------------------------------------------------------------------------- 122 | | 123 | | Here you may change the name of the cookie used to identify a session 124 | | instance by ID. The name specified here will get used every time a 125 | | new session cookie is created by the framework for every driver. 126 | | 127 | */ 128 | 129 | 'cookie' => env( 130 | 'SESSION_COOKIE', 131 | Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Session Cookie Path 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The session cookie path determines the path for which the cookie will 140 | | be regarded as available. Typically, this will be the root path of 141 | | your application but you are free to change this when necessary. 142 | | 143 | */ 144 | 145 | 'path' => '/', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Session Cookie Domain 150 | |-------------------------------------------------------------------------- 151 | | 152 | | Here you may change the domain of the cookie used to identify a session 153 | | in your application. This will determine which domains the cookie is 154 | | available to in your application. A sensible default has been set. 155 | | 156 | */ 157 | 158 | 'domain' => env('SESSION_DOMAIN'), 159 | 160 | /* 161 | |-------------------------------------------------------------------------- 162 | | HTTPS Only Cookies 163 | |-------------------------------------------------------------------------- 164 | | 165 | | By setting this option to true, session cookies will only be sent back 166 | | to the server if the browser has a HTTPS connection. This will keep 167 | | the cookie from being sent to you when it can't be done securely. 168 | | 169 | */ 170 | 171 | 'secure' => env('SESSION_SECURE_COOKIE'), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | HTTP Access Only 176 | |-------------------------------------------------------------------------- 177 | | 178 | | Setting this value to true will prevent JavaScript from accessing the 179 | | value of the cookie and the cookie will only be accessible through 180 | | the HTTP protocol. You are free to modify this option if needed. 181 | | 182 | */ 183 | 184 | 'http_only' => true, 185 | 186 | /* 187 | |-------------------------------------------------------------------------- 188 | | Same-Site Cookies 189 | |-------------------------------------------------------------------------- 190 | | 191 | | This option determines how your cookies behave when cross-site requests 192 | | take place, and can be used to mitigate CSRF attacks. By default, we 193 | | will set this value to "lax" since this is a secure default value. 194 | | 195 | | Supported: "lax", "strict", "none", null 196 | | 197 | */ 198 | 199 | 'same_site' => 'lax', 200 | 201 | /* 202 | |-------------------------------------------------------------------------- 203 | | Partitioned Cookies 204 | |-------------------------------------------------------------------------- 205 | | 206 | | Setting this value to true will tie the cookie to the top-level site for 207 | | a cross-site context. Partitioned cookies are accepted by the browser 208 | | when flagged "secure" and the Same-Site attribute is set to "none". 209 | | 210 | */ 211 | 212 | 'partitioned' => false, 213 | 214 | ]; 215 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | /** 15 | * The current password being used by the factory. 16 | */ 17 | protected static ?string $password; 18 | 19 | /** 20 | * Define the model's default state. 21 | * 22 | * @return array 23 | */ 24 | public function definition(): array 25 | { 26 | return [ 27 | 'name' => fake()->name(), 28 | 'email' => fake()->unique()->safeEmail(), 29 | 'email_verified_at' => now(), 30 | 'password' => static::$password ??= Hash::make('password'), 31 | 'remember_token' => Str::random(10), 32 | ]; 33 | } 34 | 35 | /** 36 | * Indicate that the model's email address should be unverified. 37 | */ 38 | public function unverified(): static 39 | { 40 | return $this->state(fn (array $attributes) => [ 41 | 'email_verified_at' => null, 42 | ]); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name'); 17 | $table->string('email')->unique(); 18 | $table->timestamp('email_verified_at')->nullable(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('users'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 16 | $table->string('token'); 17 | $table->timestamp('created_at')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('password_reset_tokens'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('uuid')->unique(); 17 | $table->text('connection'); 18 | $table->text('queue'); 19 | $table->longText('payload'); 20 | $table->longText('exception'); 21 | $table->timestamp('failed_at')->useCurrent(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('failed_jobs'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->morphs('tokenable'); 17 | $table->string('name'); 18 | $table->string('token', 64)->unique(); 19 | $table->text('abilities')->nullable(); 20 | $table->timestamp('last_used_at')->nullable(); 21 | $table->timestamp('expires_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('personal_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | // \App\Models\User::factory()->create([ 18 | // 'name' => 'Test User', 19 | // 'email' => 'test@example.com', 20 | // ]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | api-simulator.sail: 3 | build: 4 | context: ./vendor/laravel/sail/runtimes/8.3 5 | dockerfile: Dockerfile 6 | args: 7 | WWWGROUP: '${WWWGROUP}' 8 | image: sail-8.3/app 9 | extra_hosts: 10 | - 'host.docker.internal:host-gateway' 11 | ports: 12 | - '${APP_PORT:-80}:80' 13 | - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' 14 | environment: 15 | WWWUSER: '${WWWUSER}' 16 | LARAVEL_SAIL: 1 17 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' 18 | XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' 19 | IGNITION_LOCAL_SITES_PATH: '${PWD}' 20 | volumes: 21 | - '.:/var/www/html' 22 | networks: 23 | - sail 24 | depends_on: 25 | - mysql 26 | - redis 27 | mysql: 28 | image: 'mysql/mysql-server:8.0' 29 | ports: 30 | - '${FORWARD_DB_PORT:-3306}:3306' 31 | environment: 32 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' 33 | MYSQL_ROOT_HOST: '%' 34 | MYSQL_DATABASE: '${DB_DATABASE}' 35 | MYSQL_USER: '${DB_USERNAME}' 36 | MYSQL_PASSWORD: '${DB_PASSWORD}' 37 | MYSQL_ALLOW_EMPTY_PASSWORD: 1 38 | volumes: 39 | - 'sail-mysql:/var/lib/mysql' 40 | - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' 41 | networks: 42 | - sail 43 | healthcheck: 44 | test: 45 | - CMD 46 | - mysqladmin 47 | - ping 48 | - '-p${DB_PASSWORD}' 49 | retries: 3 50 | timeout: 5s 51 | redis: 52 | image: 'redis:alpine' 53 | ports: 54 | - '${FORWARD_REDIS_PORT:-6379}:6379' 55 | volumes: 56 | - 'sail-redis:/data' 57 | networks: 58 | - sail 59 | healthcheck: 60 | test: 61 | - CMD 62 | - redis-cli 63 | - ping 64 | retries: 3 65 | timeout: 5s 66 | networks: 67 | sail: 68 | driver: bridge 69 | volumes: 70 | sail-mysql: 71 | driver: local 72 | sail-redis: 73 | driver: local 74 | -------------------------------------------------------------------------------- /logo-api-simulator.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/logo-api-simulator.jpeg -------------------------------------------------------------------------------- /modules_statuses.json: -------------------------------------------------------------------------------- 1 | { 2 | "DomenyTv": true, 3 | "DomenyTv2": false 4 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build" 7 | }, 8 | "devDependencies": { 9 | "axios": "^1.6.4", 10 | "laravel-vite-plugin": "^1.0.0", 11 | "vite": "^5.0.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | ./Modules/*/tests/Feature 16 | ./Modules/*/tests/Unit 17 | 18 | 19 | 20 | 21 | app 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /pint.json: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "laravel", 3 | "rules": { 4 | "blank_line_before_statement": true, 5 | "concat_space": { 6 | "spacing": "one" 7 | }, 8 | "method_argument_space": true, 9 | "single_trait_insert_per_statement": true, 10 | "types_spaces": { 11 | "space": "single" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olsza/API-simulator/6421714b12d61d30dafd3194c2322c011a62128d/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Laravel 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 |
20 | @if (Route::has('login')) 21 |
22 | @auth 23 | Home 24 | @else 25 | Log in 26 | 27 | @if (Route::has('register')) 28 | Register 29 | @endif 30 | @endauth 31 |
32 | @endif 33 | 34 | 131 |
132 | 133 | 134 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ['resources/css/app.css', 'resources/js/app.js'], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | --------------------------------------------------------------------------------