ronappleton/laravel-typed-config
最新稳定版本:1.0.2
Composer 安装命令:
composer require ronappleton/laravel-typed-config
包简介
PHP Stan compliant config helper for Laravel, use config without stan complaining!
README 文档
README
Laravel Typed Config
Note
The Laravel team added this for version 11. So this should only be used for versions prior to 11
Overview
Super simple package, with a super simple job.
Provide type based config value accessors for use within Laravel to avoid Php Stan complaining about mixed types after fetching a value from a configuration file.
Installation
composer require ronappleton/laravel-typed-config
Usage
A facade is registered TypedConfig
Import Appleton\TypedConfig\Facades\TypedConfig
This will then give you access to:
TypedConfig::string(string $key, string $default = null): string TypedConfig::int(string $key, int $default = null): int TypedConfig::bool(string $key, bool $default = null): bool TypedConfig::array(string $key, array $default = null): array TypedConfig::float(string $key, float $default = null): float TypedConfig::object(string $key, object $default = null): object TypedConfig::classString(string $key, string $default = null): string
Note: classString is a special case, it will also check the class exists.
Also Repository macros have been added to allow the use through the config helper
config()->string('key', 'default') config()->int('key', 1)
for example.
统计信息
- 总下载量: 202
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-29
