triniti/sys

This package is abandoned and no longer maintained. The author suggests using the triniti/core package instead.

Php library that provides implementations for triniti:sys schemas.

v1.0.1 2019-09-03 22:01 UTC

This package is auto-updated.

Last update: 2021-06-16 23:18:10 UTC


README

Build Status Code Climate Test Coverage

Php library that provides implementations for triniti:sys schemas. Using this library assumes that you've already created and compiled your own pbj classes using the Pbjc and are making use of the "triniti:sys:mixin:*" mixins from triniti/schemas.

Symfony Integration

Enabling these services in a Symfony app is done by importing classes and letting Symfony autoconfigure and autowire them.

config/packages/sys.yml:

services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  Triniti\Sys\:
    resource: '%kernel.project_dir%/vendor/triniti/sys/src/**/*'
    bind:
      $flagset: '%app_vendor%:flagset:%kernel.environment%-%app_name%'

Twig Extension

This library provides an extension with access to flagset values. A flagset is assumed to be one per application, e.g. acme:flagset:prod-web.

Available functions:

  • flags_get_all() - Returns the flagset itself which can be json encoded or used like any other pbj instance.
  • flags_get_boolean(flag, default = false)
  • flags_get_float(flag, default = 0.0)
  • flags_get_int(flag, default = 0)
  • flags_get_string(flag, default = '')
  • flags_get_trinary(flag, default = 0)

The Twig extension is automatically available if using Symfony autowiring.