achinon/yaml_classer

将 YAML 文件转换为可调用的类,方便在 IDE 中引用。

安装: 10

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

公开问题: 0

类型:symfony-bundle

v1.0.4 2024-09-23 14:29 UTC

This package is auto-updated.

Last update: 2024-09-23 14:30:31 UTC


README

将 YAML 文件转换为可调用的类,方便在 IDE 中引用。

设置

要安装此包,请运行 composer require achinon/yaml_classer

安装包后,要生成 YAML 文件的 PHP 代码,请使用文件名和您希望它拥有的类名执行命令。

php bin/console achinon:yaml_classer example_config.yml ExampleConfig

PHP 类应被创建。

现在您可以使用依赖注入来访问配置,或者只需创建一个不带任何额外参数的新实例。

Usage example

如上例所示,导入了 YAML 文件

example: 1
example2: 'example'
example3:
  example4: 'hey'
  example5: 'hi'
  example6:
    example7: 
      - 'hello'
      - 'sadnioaseinko'
  example8: "https://github.com/Achinon/yaml_classer/"