Download the PHP package steady-as-hill/sooh-ini without Composer

On this page you can find all versions of the php package steady-as-hill/sooh-ini. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sooh-ini

配置管理类

配置分情况统一管理的封装类。设计目的是解决两点:

  1. 简化和统一获取配置的方式(比如获取时如果尚未加载就自动加载配置)
  2. 支持多种配置格式,php的,ini的,单一大文件或拆开的多个小文件

配置一般是多级的,比如数据库配置

    {
        DB: {
            mysqlAtServer1:{
                server: "1.2.3.4",
                user: "root"
                pass: "123456"
            }
        },
        Session: {
            ....
        }
    }

这种情况下,可以通过 ini::getInstance()->getIni('DB.mysqlAtServer1.server')得到"1.2.3.4"

也可以通过 ini::getInstance()->getIni('DB.mysqlAtServer1')得到 {server:"1.2.3.4",user:"root",pass:"123456"}

配置支持几种写法,参看:Ini文件格式

基本使用

1) 初始化构建ini实例(以目录模式为例):

\Sooh\Ini::getInstance()->initLoader(new \Sooh\IniClasses\Files("/root/SingleService/_config"));

如果是swoole这种,两个请求之间不会彻底释放的,需要在处理controller的action之前,ini->runtime->free();

2) 基本使用

    \Sooh\Ini::getInstance()->getIni("Email.server");
    \Sooh\Ini::getInstance()->getRuntime("some.runtime.var");
    \Sooh\Ini::getInstance()->setRuntime("some.runtime.var",mixed);

关于配置的说明

配置按存储位置分为本地和远程;按类型基本可以分为模块配置和资源配置;按作用域可以分为静态配置、运行时的动态配置以及外部配置(可跨越进程的动态配置)

Ini提供了三个public的属性应对上述情况:

针对statics,分别提供了\Sooh\IniClasses\Files 和 \Sooh\IniClasses\Url 两个获取配置的驱动

permanent 一般是自行定制的

详细使用和限制

注意:由于在定位配置的时候使用了“.”,所以配置的键值部分不能有“.”!!!

详细用法参看 Ini设计和使用

另外,当凑数也罢,这里增加了shutdown管理的相关方法,使用时要自行配套使用:

function registerShutdown($func,$identifier)

注册一个shutdown方法,当onShutdown的时候执行。($identifier 是标识, 如果执行时抛出异常了,error_log的时候会给出这个identifier)

public function onShutdown()

系统执行结束后的清理,需根据运行环境框架自行选择调用位置触发执行

您也可以使用自己的Ini类替换使用:

通过 \Sooh\Ini::getInstance(其他实例) 设置一下,之后 \Sooh\Ini::getInstance()获 得的就是这个新的“其他实例”了

配置节点的名字里如果有".",那么只能获取到上一级,之后的节点会取不到。


All versions of sooh-ini with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package steady-as-hill/sooh-ini contains the following files

Loading the files please wait ....