jstewmc/gravity 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jstewmc/gravity

Composer 安装命令:

composer require jstewmc/gravity

包简介

A framework-agnostic service and configuration manager for PHP

README 文档

README

Gravity lets other developers define settings and services in your dependency injection container using files in their packages. By pulling everything together, Gravity makes it easy to build and share small, configurable services.

Build Status codecov

Usage

As a package author, you'll define services and settings in your repository using the set() method:

# /path/to/package/.gravity/foo.php

$g->set('foo.bar.baz', true);            // defines a setting
$g->set('Foo\Bar\Baz', new StdClass());  // defines a service

As a package consumer, you'll request services and settings in your project using the get() method:

# /path/to/project/file.php

$g = (new \Jstewmc\Gravity\Gravity())->pull();  // returns Gravity's manager

$g->get('foo.bar.baz');  // returns true
$g->get('Foo\Bar\Baz');  // returns the StdClass instance

Gravity works entirely within your local filesystem. When you call the pull() method, Gravity will find the current project's root directory; search it, as well as your vendor directory, for Gravity files; load each file's service and setting definitions into the manager; and, return the manager to you. That's it!

Documentation

Gravity's documentation is available online or in the docs directory.

We strive to maintain great documentation. If you see a mistake or have a suggestion, feel free to fork and fix it!

Installation

Gravity requires PHP 7.2+.

Gravity is multi-platform, and we strive to make it run equally well on Windows, Linux, and OSX.

Gravity must be installed via Composer. To do so, add the following line to the require section of your composer.json file (where x is the latest major version), and run composer update:

{
   "require": {
       "jstewmc/gravity": "^x"
   }
}

Examples

You can run most examples in the documentation by cloning the repository to your computer, navigating to it on your filesystem, and using the PHP command line.

# navigate to a directory on your computer
$ cd ~/projects

# clone the repository to your computer
~/projects $ git clone https://github.com/jstewmc/gravity.git

# navigate to the repository
~/projects $ cd gravity

# run the first example
~/projects/gravity $ php examples/first.php

Most examples use assert() statements, and will output nothing when successful, unless stated otherwise.

Compliance

This library strives to adhere to the following standards:

  1. Keep a Changelog 1.0
  2. PSR-2
  3. PSR-11
  4. PSR-16
  5. Semantic Versioning 2.0
  6. SODO Design Pattern 0.1.0

If you spot an error, please let us know!

License

This library is licensed under the MIT license.

Credits

This library was originally developed by Jack Clayton with input from good friends like Andy O'brien and Harry Wallin.

We hope you enjoy it!

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固