home/autoph/public_html/projects/Rating-AutoHub/.git/config000064400000000420150247701710017751 0ustar00[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/autohub-group/AutoHub-Rating.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "main"] remote = origin merge = refs/heads/main view.php000064400000002035150247702500006231 0ustar00 [ resource_path('views'), ], /* |-------------------------------------------------------------------------- | Compiled View Path |-------------------------------------------------------------------------- | | This option determines where all the compiled Blade templates will be | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | */ 'compiled' => env( 'VIEW_COMPILED_PATH', realpath(storage_path('framework/views')) ), ]; cors.php000064400000001516150247702500006230 0ustar00 ['api/*', 'sanctum/csrf-cookie'], 'allowed_methods' => ['*'], 'allowed_origins' => ['*'], 'allowed_origins_patterns' => [], 'allowed_headers' => ['*'], 'exposed_headers' => [], 'max_age' => 0, 'supports_credentials' => false, ]; hashing.php000064400000003044150247702500006701 0ustar00 'bcrypt', /* |-------------------------------------------------------------------------- | Bcrypt Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Bcrypt algorithm. This will allow you | to control the amount of time it takes to hash the given password. | */ 'bcrypt' => [ 'rounds' => env('BCRYPT_ROUNDS', 10), ], /* |-------------------------------------------------------------------------- | Argon Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Argon algorithm. These will allow you | to control the amount of time it takes to hash the given password. | */ 'argon' => [ 'memory' => 65536, 'threads' => 1, 'time' => 4, ], ]; queue.php000064400000005532150247702500006410 0ustar00 env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | | Here you may configure the connection information for each server that | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | */ 'connections' => [ 'sync' => [ 'driver' => 'sync', ], 'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', 'retry_after' => 90, 'block_for' => 0, 'after_commit' => false, ], 'sqs' => [ 'driver' => 'sqs', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'default'), 'suffix' => env('SQS_SUFFIX'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'after_commit' => false, ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, 'block_for' => null, 'after_commit' => false, ], ], /* |-------------------------------------------------------------------------- | Failed Queue Jobs |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], ]; cache.php000064400000006310150247702500006322 0ustar00 env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | | Supported drivers: "apc", "array", "database", "file", | "memcached", "redis", "dynamodb", "octane", "null" | */ 'stores' => [ 'apc' => [ 'driver' => 'apc', ], 'array' => [ 'driver' => 'array', 'serialize' => false, ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, 'lock_connection' => null, ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'cache', 'lock_connection' => 'default', ], 'dynamodb' => [ 'driver' => 'dynamodb', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], 'octane' => [ 'driver' => 'octane', ], ], /* |-------------------------------------------------------------------------- | Cache Key Prefix |-------------------------------------------------------------------------- | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache | stores there might be other applications using the same cache. For | that reason, you may prefix every cache key to avoid collisions. | */ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), ]; database.php000064400000012251150247702500007024 0ustar00 env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Here are each of the database connections setup for your application. | Of course, examples of configuring each database platform that is | supported by Laravel is shown below to make development simple. | | | All database work in Laravel is done through the PHP PDO facilities | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'search_path' => 'public', 'sslmode' => 'prefer', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, // 'encrypt' => env('DB_ENCRYPT', 'yes'), // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], ], ]; services.php000064400000001723150247702500007105 0ustar00 [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 'scheme' => 'https', ], 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], 'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], ]; mail.php000064400000007020150247702500006200 0ustar00 env('MAIL_MAILER', 'smtp'), /* |-------------------------------------------------------------------------- | Mailer Configurations |-------------------------------------------------------------------------- | | Here you may configure all of the mailers used by your application plus | their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | | Laravel supports a variety of mail "transport" drivers to be used while | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | | Supported: "smtp", "sendmail", "mailgun", "ses", | "postmark", "log", "array", "failover" | */ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, 'local_domain' => env('MAIL_EHLO_DOMAIN'), ], 'ses' => [ 'transport' => 'ses', ], 'mailgun' => [ 'transport' => 'mailgun', ], 'postmark' => [ 'transport' => 'postmark', ], 'sendmail' => [ 'transport' => 'sendmail', 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ 'transport' => 'array', ], 'failover' => [ 'transport' => 'failover', 'mailers' => [ 'smtp', 'log', ], ], ], /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* |-------------------------------------------------------------------------- | Markdown Mail Settings |-------------------------------------------------------------------------- | | If you are using Markdown based email rendering, you may configure your | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | */ 'markdown' => [ 'theme' => 'default', 'paths' => [ resource_path('views/vendor/mail'), ], ], ]; broadcasting.php000064400000004053150247702500007721 0ustar00 env('BROADCAST_DRIVER', 'null'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here you may define all of the broadcast connections that will be used | to broadcast events to other systems or over websockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], 'client_options' => [ // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html ], ], 'ably' => [ 'driver' => 'ably', 'key' => env('ABLY_KEY'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], 'log' => [ 'driver' => 'log', ], 'null' => [ 'driver' => 'null', ], ], ]; logging.php000064400000007245150247702500006715 0ustar00 env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Deprecations Log Channel |-------------------------------------------------------------------------- | | This option controls the log channel that should be used to log warnings | regarding deprecated PHP and library features. This allows you to get | your application ready for upcoming major versions of dependencies. | */ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 'trace' => false, ], /* |-------------------------------------------------------------------------- | Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for your application. Out of | the box, Laravel uses the Monolog PHP logging library. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "single", "daily", "slack", "syslog", | "errorlog", "monolog", | "custom", "stack" | */ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), ], 'papertrail' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], ], 'stderr' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], ], ]; session.php000064400000015557150247702500006757 0ustar00 env('SESSION_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | */ 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => env('SESSION_CONNECTION'), /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table we | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | */ 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | | While using one of the framework's cache driven session backends you may | list a cache store that should be used for these sessions. This value | must match with one of the application's configured cache "stores". | | Affects: "apc", "dynamodb", "memcached", "redis" | */ 'store' => env('SESSION_STORE'), /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the cookie used to identify a session | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | */ 'cookie' => env( 'SESSION_COOKIE', Str::slug(env('APP_NAME', 'laravel'), '_').'_session' ), /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => env('SESSION_DOMAIN'), /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you when it can't be done securely. | */ 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- | HTTP Access Only |-------------------------------------------------------------------------- | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through | the HTTP protocol. You are free to modify this option if needed. | */ 'http_only' => true, /* |-------------------------------------------------------------------------- | Same-Site Cookies |-------------------------------------------------------------------------- | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we | will set this value to "lax" since this is a secure default value. | | Supported: "lax", "strict", "none", null | */ 'same_site' => 'lax', ]; auth.php000064400000007121150247702500006221 0ustar00 [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\Models\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, 'throttle' => 60, ], ], /* |-------------------------------------------------------------------------- | Password Confirmation Timeout |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ 'password_timeout' => 10800, ]; app.php000064400000017306150247702500006046 0ustar00 env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- | Application Environment |-------------------------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services the application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => (bool) env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of | your application so that it is used when running Artisan tasks. | */ 'url' => env('APP_URL', 'http://localhost'), 'asset_url' => env('ASSET_URL'), /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | */ 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used | by the translation service provider. You are free to set this value | to any of the locales which will be supported by the application. | */ 'locale' => 'en', /* |-------------------------------------------------------------------------- | Application Fallback Locale |-------------------------------------------------------------------------- | | The fallback locale determines the locale to use when the current one | is not available. You may change the value to correspond to any of | the language folders that are provided through your application. | */ 'fallback_locale' => 'en', /* |-------------------------------------------------------------------------- | Faker Locale |-------------------------------------------------------------------------- | | This locale will be used by the Faker PHP library when generating fake | data for your database seeds. For example, this will be used to get | localized telephone numbers, street address information and more. | */ 'faker_locale' => 'en_US', /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | This key is used by the Illuminate encrypter service and should be set | to a random, 32 character string, otherwise these encrypted strings | will not be safe. Please do this before deploying an application! | */ 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- | Maintenance Mode Driver |-------------------------------------------------------------------------- | | These configuration options determine the driver used to determine and | manage Laravel's "maintenance mode" status. The "cache" driver will | allow maintenance mode to be controlled across multiple machines. | | Supported drivers: "file", "cache" | */ 'maintenance' => [ 'driver' => 'file', // 'store' => 'redis', ], /* |-------------------------------------------------------------------------- | Autoloaded Service Providers |-------------------------------------------------------------------------- | | The service providers listed here will be automatically loaded on the | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | */ 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, Illuminate\Cache\CacheServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Cookie\CookieServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class, Illuminate\Filesystem\FilesystemServiceProvider::class, Illuminate\Foundation\Providers\FoundationServiceProvider::class, Illuminate\Hashing\HashServiceProvider::class, Illuminate\Mail\MailServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Pagination\PaginationServiceProvider::class, Illuminate\Pipeline\PipelineServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, /* * Package Service Providers... */ /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, Barryvdh\DomPDF\ServiceProvider::class, ], /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ 'aliases' => Facade::defaultAliases()->merge([ // 'ExampleClass' => App\Example\ExampleClass::class, 'PDF' => Barryvdh\DomPDF\Facade::class, ])->toArray(), ]; filesystems.php000064400000004502150247702500007627 0ustar00 env('FILESYSTEM_DISK', 'local'), /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have | been set up for each driver as an example of the required values. | | Supported Drivers: "local", "ftp", "sftp", "s3" | */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), 'throw' => false, ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', 'throw' => false, ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 'throw' => false, ], ], /* |-------------------------------------------------------------------------- | Symbolic Links |-------------------------------------------------------------------------- | | Here you may configure the symbolic links that will be created when the | `storage:link` Artisan command is executed. The array keys should be | the locations of the links and the values should be their targets. | */ 'links' => [ public_path('storage') => storage_path('app/public'), ], ]; sanctum.php000064400000004366150247702500006742 0ustar00 explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( '%s%s', 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', Sanctum::currentApplicationUrlWithPort() ))), /* |-------------------------------------------------------------------------- | Sanctum Guards |-------------------------------------------------------------------------- | | This array contains the authentication guards that will be checked when | Sanctum is trying to authenticate a request. If none of these guards | are able to authenticate the request, Sanctum will use the bearer | token that's present on an incoming request for authentication. | */ 'guard' => ['web'], /* |-------------------------------------------------------------------------- | Expiration Minutes |-------------------------------------------------------------------------- | | This value controls the number of minutes until an issued token will be | considered expired. If this value is null, personal access tokens do | not expire. This won't tweak the lifetime of first-party sessions. | */ 'expiration' => null, /* |-------------------------------------------------------------------------- | Sanctum Middleware |-------------------------------------------------------------------------- | | When authenticating your first-party SPA with Sanctum you may need to | customize some of the middleware Sanctum uses while processing the | request. You may change the middleware listed below as required. | */ 'middleware' => [ 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, ], ]; dompdf.php000064400000026324150247702500006537 0ustar00 false, // Throw an Exception on warnings from dompdf 'public_path' => null, // Override the public path if needed /* * Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £. */ 'convert_entities' => true, 'options' => array( /** * The location of the DOMPDF font directory * * The location of the directory where DOMPDF will store fonts and font metrics * Note: This directory must exist and be writable by the webserver process. * *Please note the trailing slash.* * * Notes regarding fonts: * Additional .afm font metrics can be added by executing load_font.php from command line. * * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must * be embedded in the pdf file or the PDF may not display correctly. This can significantly * increase file size unless font subsetting is enabled. Before embedding a font please * review your rights under the font license. * * Any font specification in the source HTML is translated to the closest font available * in the font directory. * * The pdf standard "Base 14 fonts" are: * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic, * Symbol, ZapfDingbats. */ "font_dir" => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) /** * The location of the DOMPDF font cache directory * * This directory contains the cached font metrics for the fonts used by DOMPDF. * This directory can be the same as DOMPDF_FONT_DIR * * Note: This directory must exist and be writable by the webserver process. */ "font_cache" => storage_path('fonts'), /** * The location of a temporary directory. * * The directory specified must be writeable by the webserver process. * The temporary directory is required to download remote images and when * using the PFDLib back end. */ "temp_dir" => sys_get_temp_dir(), /** * ==== IMPORTANT ==== * * dompdf's "chroot": Prevents dompdf from accessing system files or other * files on the webserver. All local files opened by dompdf must be in a * subdirectory of this directory. DO NOT set it to '/' since this could * allow an attacker to use dompdf to read any files on the server. This * should be an absolute path. * This is only checked on command line call by dompdf.php, but not by * direct class use like: * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); */ "chroot" => realpath(base_path()), /** * Protocol whitelist * * Protocols and PHP wrappers allowed in URIs, and the validation rules * that determine if a resouce may be loaded. Full support is not guaranteed * for the protocols/wrappers specified * by this array. * * @var array */ 'allowed_protocols' => [ "file://" => ["rules" => []], "http://" => ["rules" => []], "https://" => ["rules" => []] ], /** * @var string */ 'log_output_file' => null, /** * Whether to enable font subsetting or not. */ "enable_font_subsetting" => false, /** * The PDF rendering backend to use * * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link * Canvas_Factory} ultimately determines which rendering class to instantiate * based on this setting. * * Both PDFLib & CPDF rendering backends provide sufficient rendering * capabilities for dompdf, however additional features (e.g. object, * image and font support, etc.) differ between backends. Please see * {@link PDFLib_Adapter} for more information on the PDFLib backend * and {@link CPDF_Adapter} and lib/class.pdf.php for more information * on CPDF. Also see the documentation for each backend at the links * below. * * The GD rendering backend is a little different than PDFLib and * CPDF. Several features of CPDF and PDFLib are not supported or do * not make any sense when creating image files. For example, * multiple pages are not supported, nor are PDF 'objects'. Have a * look at {@link GD_Adapter} for more information. GD support is * experimental, so use it at your own risk. * * @link http://www.pdflib.com * @link http://www.ros.co.nz/pdf * @link http://www.php.net/image */ "pdf_backend" => "CPDF", /** * PDFlib license key * * If you are using a licensed, commercial version of PDFlib, specify * your license key here. If you are using PDFlib-Lite or are evaluating * the commercial version of PDFlib, comment out this setting. * * @link http://www.pdflib.com * * If pdflib present in web server and auto or selected explicitely above, * a real license code must exist! */ //"DOMPDF_PDFLIB_LICENSE" => "your license key here", /** * html target media view which should be rendered into pdf. * List of types and parsing rules for future extensions: * http://www.w3.org/TR/REC-html40/types.html * screen, tty, tv, projection, handheld, print, braille, aural, all * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3. * Note, even though the generated pdf file is intended for print output, * the desired content might be different (e.g. screen or projection view of html file). * Therefore allow specification of content here. */ "default_media_type" => "screen", /** * The default paper size. * * North America standard is "letter"; other countries generally "a4" * * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) */ "default_paper_size" => "a4", /** * The default paper orientation. * * The orientation of the page (portrait or landscape). * * @var string */ 'default_paper_orientation' => "portrait", /** * The default font family * * Used if no suitable fonts can be found. This must exist in the font folder. * @var string */ "default_font" => "serif", /** * Image DPI setting * * This setting determines the default DPI setting for images and fonts. The * DPI may be overridden for inline images by explictly setting the * image's width & height style attributes (i.e. if the image's native * width is 600 pixels and you specify the image's width as 72 points, * the image will have a DPI of 600 in the rendered PDF. The DPI of * background images can not be overridden and is controlled entirely * via this parameter. * * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). * If a size in html is given as px (or without unit as image size), * this tells the corresponding size in pt. * This adjusts the relative sizes to be similar to the rendering of the * html page in a reference browser. * * In pdf, always 1 pt = 1/72 inch * * Rendering resolution of various browsers in px per inch: * Windows Firefox and Internet Explorer: * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? * Linux Firefox: * about:config *resolution: Default:96 * (xorg screen dimension in mm and Desktop font dpi settings are ignored) * * Take care about extra font/image zoom factor of browser. * * In images, size in pixel attribute, img css style, are overriding * the real image dimension in px for rendering. * * @var int */ "dpi" => 96, /** * Enable inline PHP * * If this setting is set to true then DOMPDF will automatically evaluate * inline PHP contained within tags. * * Enabling this for documents you do not trust (e.g. arbitrary remote html * pages) is a security risk. Set this option to false if you wish to process * untrusted documents. * * @var bool */ "enable_php" => false, /** * Enable inline Javascript * * If this setting is set to true then DOMPDF will automatically insert * JavaScript code contained within tags. * * @var bool */ "enable_javascript" => true, /** * Enable remote file access * * If this setting is set to true, DOMPDF will access remote sites for * images and CSS files as required. * This is required for part of test case www/test/image_variants.html through www/examples.php * * Attention! * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and * allowing remote access to dompdf.php or on allowing remote html code to be passed to * $dompdf = new DOMPDF(, $dompdf->load_html(..., * This allows anonymous users to download legally doubtful internet content which on * tracing back appears to being downloaded by your server, or allows malicious php code * in remote html pages to be executed by your server with your account privileges. * * @var bool */ "enable_remote" => true, /** * A ratio applied to the fonts height to be more like browsers' line height */ "font_height_ratio" => 1.1, /** * Use the HTML5 Lib parser * * @deprecated This feature is now always on in dompdf 2.x * @var bool */ "enable_html5_parser" => true, ), ); LICENSE.md000064400000002751150250323470006156 0ustar00BSD 3-Clause License Copyright (c) 2022, Colin O'Dell. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. composer.json000064400000003652150250323470007275 0ustar00{ "name": "league/config", "type": "library", "description": "Define configuration arrays with strict schemas and access values with dot notation", "keywords": ["configuration","config","schema","array","nested","dot","dot-access"], "homepage": "https://config.thephpleague.com", "license": "BSD-3-Clause", "authors": [ { "name": "Colin O'Dell", "email": "colinodell@gmail.com", "homepage": "https://www.colinodell.com", "role": "Lead Developer" } ], "support": { "docs": "https://config.thephpleague.com/", "issues": "https://github.com/thephpleague/config/issues", "rss": "https://github.com/thephpleague/config/releases.atom", "source": "https://github.com/thephpleague/config" }, "require": { "php": "^7.4 || ^8.0", "dflydev/dot-access-data": "^3.0.1", "nette/schema": "^1.2" }, "require-dev": { "phpstan/phpstan": "^1.8.2", "phpunit/phpunit": "^9.5.5", "scrutinizer/ocular": "^1.8.1", "unleashedtech/php-coding-standard": "^3.1", "vimeo/psalm": "^4.7.3" }, "minimum-stability": "dev", "prefer-stable": true, "autoload": { "psr-4": { "League\\Config\\": "src" } }, "autoload-dev": { "psr-4": { "League\\Config\\Tests\\": "tests" } }, "scripts": { "phpcs": "phpcs", "phpstan": "phpstan analyse", "phpunit": "phpunit --no-coverage", "psalm": "psalm", "test": [ "@phpcs", "@phpstan", "@psalm", "@phpunit" ] }, "extra": { "branch-alias": { "dev-main": "1.2-dev" } }, "config": { "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } } } CHANGELOG.md000064400000002403150250323470006355 0ustar00# Change Log All notable changes to this project will be documented in this file. Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. ## [Unreleased][unreleased] ## [1.2.0] - 2022-12-11 ### Changed - Values can now be set prior to the corresponding schema being registered. - `exists()` and `get()` now only trigger validation for the relevant schema, not the entire config at once. ## [1.1.1] - 2021-08-14 ### Changed - Bumped the minimum version of dflydev/dot-access-data for PHP 8.1 support ## [1.1.0] - 2021-06-19 ### Changed - Bumped the minimum PHP version to 7.4+ - Bumped the minimum version of nette/schema to 1.2.0 ## [1.0.1] - 2021-05-31 ### Fixed - Fixed the `ConfigurationExceptionInterface` marker interface not extending `Throwable` (#2) ## [1.0.0] - 2021-05-31 Initial release! 🎉 [unreleased]: https://github.com/thephpleague/config/compare/v1.2.0...main [1.2.0]: https://github.com/thephpleague/config/compare/v1.1.1...v.1.2.0 [1.1.1]: https://github.com/thephpleague/config/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/thephpleague/config/compare/v1.0.1...v1.1.0 [1.0.1]: https://github.com/thephpleague/config/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/thephpleague/config/releases/tag/v1.0.0 src/ConfigurationBuilderInterface.php000064400000000762150250323470014011 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; /** * An interface that provides the ability to set both the schema and configuration values */ interface ConfigurationBuilderInterface extends MutableConfigurationInterface, SchemaBuilderInterface { } src/ConfigurationProviderInterface.php000064400000000745150250323470014216 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; /** * Interface for a service which provides a readable configuration object */ interface ConfigurationProviderInterface { public function getConfiguration(): ConfigurationInterface; } src/Exception/ValidationException.php000064400000001536150250323470013761 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config\Exception; use Nette\Schema\ValidationException as NetteException; final class ValidationException extends InvalidConfigurationException { /** @var string[] */ private array $messages; public function __construct(NetteException $innerException) { parent::__construct($innerException->getMessage(), (int) $innerException->getCode(), $innerException); $this->messages = $innerException->getMessages(); } /** * @return string[] */ public function getMessages(): array { return $this->messages; } } src/Exception/UnknownOptionException.php000064400000001354150250323470014515 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config\Exception; use Throwable; final class UnknownOptionException extends \InvalidArgumentException implements ConfigurationExceptionInterface { private string $path; public function __construct(string $message, string $path, int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->path = $path; } public function getPath(): string { return $this->path; } } src/Exception/InvalidConfigurationException.php000064400000002403150250323470015777 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config\Exception; class InvalidConfigurationException extends \UnexpectedValueException implements ConfigurationExceptionInterface { /** * @param string $option Name/path of the option * @param mixed $valueGiven The invalid option that was provided * @param ?string $description Additional text describing the issue (optional) */ public static function forConfigOption(string $option, $valueGiven, ?string $description = null): self { $message = \sprintf('Invalid config option for "%s": %s', $option, self::getDebugValue($valueGiven)); if ($description !== null) { $message .= \sprintf(' (%s)', $description); } return new self($message); } /** * @param mixed $value * * @psalm-pure */ private static function getDebugValue($value): string { if (\is_object($value)) { return \get_class($value); } return \print_r($value, true); } } src/Exception/ConfigurationExceptionInterface.php000064400000000673150250323470016320 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config\Exception; /** * Marker interface for any/all exceptions thrown by this library */ interface ConfigurationExceptionInterface extends \Throwable { } src/SchemaBuilderInterface.php000064400000001112150250323470012370 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; use Nette\Schema\Schema; /** * Interface that allows new schemas to be added to a configuration */ interface SchemaBuilderInterface { /** * Registers a new configuration schema at the given top-level key */ public function addSchema(string $key, Schema $schema): void; } src/MutableConfigurationInterface.php000064400000001462150250323470014012 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; use League\Config\Exception\UnknownOptionException; /** * Interface for setting/merging user-defined configuration values into the configuration object */ interface MutableConfigurationInterface { /** * @param mixed $value * * @throws UnknownOptionException if $key contains a nested path which doesn't point to an array value */ public function set(string $key, $value): void; /** * @param array $config */ public function merge(array $config = []): void; } src/Configuration.php000064400000014524150250323470010662 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; use Dflydev\DotAccessData\Data; use Dflydev\DotAccessData\DataInterface; use Dflydev\DotAccessData\Exception\DataException; use Dflydev\DotAccessData\Exception\InvalidPathException; use Dflydev\DotAccessData\Exception\MissingPathException; use League\Config\Exception\UnknownOptionException; use League\Config\Exception\ValidationException; use Nette\Schema\Expect; use Nette\Schema\Processor; use Nette\Schema\Schema; use Nette\Schema\ValidationException as NetteValidationException; final class Configuration implements ConfigurationBuilderInterface, ConfigurationInterface { /** @psalm-readonly */ private Data $userConfig; /** * @var array * * @psalm-allow-private-mutation */ private array $configSchemas = []; /** @psalm-allow-private-mutation */ private Data $finalConfig; /** * @var array * * @psalm-allow-private-mutation */ private array $cache = []; /** @psalm-readonly */ private ConfigurationInterface $reader; /** * @param array $baseSchemas */ public function __construct(array $baseSchemas = []) { $this->configSchemas = $baseSchemas; $this->userConfig = new Data(); $this->finalConfig = new Data(); $this->reader = new ReadOnlyConfiguration($this); } /** * Registers a new configuration schema at the given top-level key * * @psalm-allow-private-mutation */ public function addSchema(string $key, Schema $schema): void { $this->invalidate(); $this->configSchemas[$key] = $schema; } /** * {@inheritDoc} * * @psalm-allow-private-mutation */ public function merge(array $config = []): void { $this->invalidate(); $this->userConfig->import($config, DataInterface::REPLACE); } /** * {@inheritDoc} * * @psalm-allow-private-mutation */ public function set(string $key, $value): void { $this->invalidate(); try { $this->userConfig->set($key, $value); } catch (DataException $ex) { throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); } } /** * {@inheritDoc} * * @psalm-external-mutation-free */ public function get(string $key) { if (\array_key_exists($key, $this->cache)) { return $this->cache[$key]; } try { $this->build(self::getTopLevelKey($key)); return $this->cache[$key] = $this->finalConfig->get($key); } catch (InvalidPathException | MissingPathException $ex) { throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); } } /** * {@inheritDoc} * * @psalm-external-mutation-free */ public function exists(string $key): bool { if (\array_key_exists($key, $this->cache)) { return true; } try { $this->build(self::getTopLevelKey($key)); return $this->finalConfig->has($key); } catch (InvalidPathException | UnknownOptionException $ex) { return false; } } /** * @psalm-mutation-free */ public function reader(): ConfigurationInterface { return $this->reader; } /** * @psalm-external-mutation-free */ private function invalidate(): void { $this->cache = []; $this->finalConfig = new Data(); } /** * Applies the schema against the configuration to return the final configuration * * @throws ValidationException|UnknownOptionException|InvalidPathException * * @psalm-allow-private-mutation */ private function build(string $topLevelKey): void { if ($this->finalConfig->has($topLevelKey)) { return; } if (! isset($this->configSchemas[$topLevelKey])) { throw new UnknownOptionException(\sprintf('Missing config schema for "%s"', $topLevelKey), $topLevelKey); } try { $userData = [$topLevelKey => $this->userConfig->get($topLevelKey)]; } catch (DataException $ex) { $userData = []; } try { $schema = $this->configSchemas[$topLevelKey]; $processor = new Processor(); $processed = $processor->process(Expect::structure([$topLevelKey => $schema]), $userData); $this->raiseAnyDeprecationNotices($processor->getWarnings()); $this->finalConfig->import((array) self::convertStdClassesToArrays($processed)); } catch (NetteValidationException $ex) { throw new ValidationException($ex); } } /** * Recursively converts stdClass instances to arrays * * @phpstan-template T * * @param T $data * * @return mixed * * @phpstan-return ($data is \stdClass ? array : T) * * @psalm-pure */ private static function convertStdClassesToArrays($data) { if ($data instanceof \stdClass) { $data = (array) $data; } if (\is_array($data)) { foreach ($data as $k => $v) { $data[$k] = self::convertStdClassesToArrays($v); } } return $data; } /** * @param string[] $warnings */ private function raiseAnyDeprecationNotices(array $warnings): void { foreach ($warnings as $warning) { @\trigger_error($warning, \E_USER_DEPRECATED); } } /** * @throws InvalidPathException */ private static function getTopLevelKey(string $path): string { if (\strlen($path) === 0) { throw new InvalidPathException('Path cannot be an empty string'); } $path = \str_replace(['.', '/'], '.', $path); $firstDelimiter = \strpos($path, '.'); if ($firstDelimiter === false) { return $path; } return \substr($path, 0, $firstDelimiter); } } src/ConfigurationAwareInterface.php000064400000001004150250323470013450 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; /** * Implement this class to facilitate setter injection of the configuration where needed */ interface ConfigurationAwareInterface { public function setConfiguration(ConfigurationInterface $configuration): void; } src/ReadOnlyConfiguration.php000064400000001442150250323470012313 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; /** * Provides read-only access to a given Configuration object */ final class ReadOnlyConfiguration implements ConfigurationInterface { private Configuration $config; public function __construct(Configuration $config) { $this->config = $config; } /** * {@inheritDoc} */ public function get(string $key) { return $this->config->get($key); } public function exists(string $key): bool { return $this->config->exists($key); } } src/ConfigurationInterface.php000064400000002226150250323470012477 0ustar00 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\Config; use League\Config\Exception\UnknownOptionException; use League\Config\Exception\ValidationException; /** * Interface for reading configuration values */ interface ConfigurationInterface { /** * @param string $key Configuration option path/key * * @psalm-param non-empty-string $key * * @return mixed * * @throws ValidationException if the schema failed to validate the given input * @throws UnknownOptionException if the requested key does not exist or is malformed */ public function get(string $key); /** * @param string $key Configuration option path/key * * @psalm-param non-empty-string $key * * @return bool Whether the given option exists * * @throws ValidationException if the schema failed to validate the given input */ public function exists(string $key): bool; } README.md000064400000016002150250323470006023 0ustar00# league/config [![Latest Version](https://img.shields.io/packagist/v/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) [![Total Downloads](https://img.shields.io/packagist/dt/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) [![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) [![Build Status](https://img.shields.io/github/workflow/status/thephpleague/config/Tests/main.svg?style=flat-square)](https://github.com/thephpleague/config/actions?query=workflow%3ATests+branch%3Amain) [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config/code-structure) [![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config) [![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor) **league/config** helps you define nested configuration arrays with strict schemas and access configuration values with dot notation. It was created by [Colin O'Dell][@colinodell]. ## 📦 Installation This project requires PHP 7.4 or higher. To install it via [Composer] simply run: ```bash composer require league/config ``` ## 🧰️ Basic Usage The `Configuration` class provides everything you need to define the configuration structure and fetch values: ```php use League\Config\Configuration; use Nette\Schema\Expect; // Define your configuration schema $config = new Configuration([ 'database' => Expect::structure([ 'driver' => Expect::anyOf('mysql', 'postgresql', 'sqlite')->required(), 'host' => Expect::string()->default('localhost'), 'port' => Expect::int()->min(1)->max(65535), 'ssl' => Expect::bool(), 'database' => Expect::string()->required(), 'username' => Expect::string()->required(), 'password' => Expect::string()->nullable(), ]), 'logging' => Expect::structure([ 'enabled' => Expect::bool()->default($_ENV['DEBUG'] == true), 'file' => Expect::string()->deprecated("use logging.path instead"), 'path' => Expect::string()->assert(function ($path) { return \is_writeable($path); })->required(), ]), ]); // Set the values, either all at once with `merge()`: $config->merge([ 'database' => [ 'driver' => 'mysql', 'port' => 3306, 'database' => 'mydb', 'username' => 'user', 'password' => 'secret', ], ]); // Or one-at-a-time with `set()`: $config->set('logging.path', '/var/log/myapp.log'); // You can now retrieve those values with `get()`. // Validation and defaults will be applied for you automatically $config->get('database'); // Fetches the entire "database" section as an array $config->get('database.driver'); // Fetch a specific nested value with dot notation $config->get('database/driver'); // Fetch a specific nested value with slash notation $config->get('database.host'); // Returns the default value "localhost" $config->get('logging.path'); // Guaranteed to be writeable thanks to the assertion in the schema // If validation fails an `InvalidConfigurationException` will be thrown: $config->set('database.driver', 'mongodb'); $config->get('database.driver'); // InvalidConfigurationException // Attempting to fetch a non-existent key will result in an `InvalidConfigurationException` $config->get('foo.bar'); // You could avoid this by checking whether that item exists: $config->exists('foo.bar'); // Returns `false` ``` ## 📓 Documentation Full documentation can be found at [config.thephpleague.com][docs]. ## 💭 Philosophy This library aims to provide a **simple yet opinionated** approach to configuration with the following goals: - The configuration should operate on **arrays with nested values** which are easily accessible - The configuration structure should be **defined with strict schemas** defining the overall structure, allowed types, and allowed values - Schemas should be defined using a **simple, fluent interface** - You should be able to **add and combine schemas but never modify existing ones** - Both the configuration values and the schema should be **defined and managed with PHP code** - Schemas should be **immutable**; they should never change once they are set - Configuration values should never define or influence the schemas As a result, this library will likely **never** support features like: - Loading and/or exporting configuration values or schemas using YAML, XML, or other files - Parsing configuration values from a command line or other user interface - Dynamically changing the schema, allowed values, or default values based on other configuration values If you need that functionality you should check out other libraries like: - [symfony/config] - [symfony/options-resolver] - [hassankhan/config] - [consolidation/config] - [laminas/laminas-config] ## 🏷️ Versioning [SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase. Any classes or methods marked `@internal` are not intended for use outside this library and are subject to breaking changes at any time, so please avoid using them. ## 🛠️ Maintenance & Support When a new **minor** version (e.g. `1.0` -> `1.1`) is released, the previous one (`1.0`) will continue to receive security and critical bug fixes for *at least* 3 months. When a new **major** version is released (e.g. `1.1` -> `2.0`), the previous one (`1.1`) will receive critical bug fixes for *at least* 3 months and security updates for 6 months after that new release comes out. (This policy may change in the future and exceptions may be made on a case-by-case basis.) ## 👷‍️ Contributing Contributions to this library are **welcome**! We only ask that you adhere to our [contributor guidelines] and avoid making changes that conflict with our Philosophy above. ## 🧪 Testing ```bash composer test ``` ## 📄 License **league/config** is licensed under the BSD-3 license. See the [`LICENSE.md`][license] file for more details. ## 🗺️ Who Uses It? This project is used by [league/commonmark][league-commonmark]. [docs]: https://config.thephpleague.com/ [@colinodell]: https://www.twitter.com/colinodell [Composer]: https://getcomposer.org/ [PHP League]: https://thephpleague.com [symfony/config]: https://symfony.com/doc/current/components/config.html [symfony/options-resolver]: https://symfony.com/doc/current/components/options_resolver.html [hassankhan/config]: https://github.com/hassankhan/config [consolidation/config]: https://github.com/consolidation/config [laminas/laminas-config]: https://docs.laminas.dev/laminas-config/ [contributor guidelines]: https://github.com/thephpleague/config/blob/main/.github/CONTRIBUTING.md [license]: https://github.com/thephpleague/config/blob/main/LICENSE.md [league-commonmark]: https://commonmark.thephpleague.com