Git Product home page Git Product logo

php-utilities's Introduction

php-utilities

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

About

This library is all about helping with the common little problems like having a type of object to inherit from with an internal data storage to turn to a json or array, ...

Usage

A lot of examples on how to use the classes can be found in the UnitTests. The whole collection is extensively tested and therefore quite stable. Feel free to contribute, suggest changes or help make it better.

Contents

You'll get following groups of classes which are interdependent

Data

This part consists of two distinct classes:

  • Data is a data store where you can easily store and retrieve data.
  • DataCollection ist a container to house items like objects, iterable.

Config

Here you get a static factory which is able to produce three types of configuration objects, based on Data class. All config objects take yaml files as source and provide easy access via get/set methods. See UnitTests for examples. Available types are:

  • ConfigDefault - basic config object, stores the yaml content "as is", provides get/set.
  • ConfigEnv - provides the possibility to get an environment-merged config. Based on the currently provided env, you'll have e.g. prod -> dev merged, with prod node as a master.
  • ConfigTimer is a specialised for of config to provide pre-generated DateTime objects for the Timer class.

Configs now also support the "imports" syntax from symfony configs.

imports:
    - { resource: defaults.yml }

There is the possibility to use a "default" node in all configs, except timers, which will be used as merge-base. Imported configs will be treated just like the "default" node and also become the base for merging. The order of merges is import -> default -> prod -> $env.

Timer

Provides functionality to check if there's a current holiday, has configurable "timers" to check uf e.g. your hotline should be available etc. Extensive examples can be found within both, the TestData and UnitTests :-)

Test

TestData is just a helper for providing configurations for either Config and Timer. Have a look for YAML config examples.

php-utilities's People

Contributors

lerua83 avatar maschmann avatar scrutinizer-auto-fixer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.