Giter Site home page Giter Site logo

flint / tacker Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 6.0 78 KB

Easy loading of configurations files using Symfony Config. Supports Normalization, Inheritance and a buttload of filetypes.

Home Page: http://flint.rtfd.org/projects/tacker

License: MIT License

PHP 100.00%

tacker's Introduction

Flint

Build Status

Flint is a microframework build on top of Silex. It brings the full Router, conventions and structure to Silex.

You can read more about in it documentation.

tacker's People

Contributors

davedevelopment avatar henrikbjorn avatar relvinhas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tacker's Issues

Symfony/Config 3.x

Catchable fatal error: Object of class Symfony\Component\Config\ConfigCache could not be converted to string in vendor/flint/tacker/src/Tacker/Loader/CacheLoader.php on line 58

require:
"symfony/config" : ">=2.3"
should be:
"symfony/config" : "^2.3"

Normalizers should not do string replacements

currently, the normalizers are used as string replacement before the parsing. But this means that they would need to produce a different output depending on the format of the loaded file, because of the escaping needed for the format.

Here is an example:

$pimple = new Pimple();
$pimple['message'] = '"This is a message starting with a quote';

$yaml = <<<YAML
my_param: %message%
YAML;

$processed = (new Tacker\Normalizer\PimpleNormalizer($pimple))->normalize($yaml);

$result = <<<YAML
my_param: "This is a message starting with a quote
YAML;

$neededResult = <<<YAML
my_param: '"This is a message starting with a quote'
YAML;

We have $processed === $result, but $result is invalid Yaml, because a string value starting with a double quote needs to be quoted (here, the quote is matched as the beginning of a double quoted value, with a missing closing quote thorwing a parse error).
Other easy broken cases are true vs 'true' or a string containing a # (comment marker in Yaml if you don't quote the value), and they are not the only ones.

This issue is of course not specific to YAML. Other formats can also get broken.

a side effect is that the config will get inconsistent:

my_param: %debug%
{ "my_param": "%debug" }
$yamlConfig === array('my_param' => true);

$jsonConfig === array('my_param' => 'true');

Merge multiple configs

I expect options to be merged instead of being overwritten:

config.yml

php:
    timezone: "UTC"
    error_reporting: 0
    ini:
        display_errors: false
        display_startup_errors: false

config_development.yml

php:
    error_reporting: -1
    ini:
        display_errors: true
        display_startup_errors: true

Expected result:

$app['php']['timezone'] contains "UTC"

Actual results:

$app['php']['timezone'] does not exist

Symfony/Yaml 3.x

The ability to pass file names to the \Symfony\Component\Yaml\Yaml::parse method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.

require-dev:
"symfony/yaml" : "~2.2"
should be:
"symfony/yaml" : "^2.2"

Recursively resolve options in configuration file

If my configuration looks like:

kernel.env: "#KERNEL_ENV#"
monolog.logfile: "%root_dir%/logs/%kernel.env%.log"

I would like/expect kernel.env to be available (e.g. can be referenced) by all subsequent option definitions. The only constraint being of course that options can only refer to previously defined options (so order of definitions is relevant).

Not sure if this properly describes what I mean, fingers crossed.

EnvironmentNormalizer tried to normalize object

Hi Henrik.

This issue is on version 1.2.1of flint/tacker.
I haven't upgraded due to the dependencies for Pimple 1.0 and Silex 1.3

I have a security configuration like this:

security.firewalls:
    secret:
        pattern: "^/something"
        my_login:
            logout_return_path: '/logout/success'
            login_return_path: '/somepath
        users: %security.user_provider.my_login%
        logout:
            logout_path: '/somepath/logout'

users: %security.user_provider.my_login% is picked up fine by the PimpleNormalizer but just after the EnvironmentNormalizer triggers and at this point tries to convert my object into a string which fails of course. Do you know why it would try and parse the object in the EnvironmentNormalizer since it was picked up by the PimpleNormalizer?

If I simply check for objects in the EnvironmentNormalizer and return if so then the code seems to run as expected.

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.