Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFR]Config Support for reading PHP files #1439

Merged
merged 9 commits into from
Oct 25, 2013
Merged

[NFR]Config Support for reading PHP files #1439

merged 9 commits into from
Oct 25, 2013

Conversation

dreamsxin
Copy link
Contributor

config.php

<?php

return array(
        "database" => array(
            "adapter" => "mysql",
            "host" => "localhost",
            "username" => "user",
            "password" => "passwd",
            "name" => "demo"
        ),
    );

Use

$config = new Phalcon\Config\Adapter\Php('../app/config/config.php');

@ghost
Copy link

ghost commented Oct 25, 2013

@dreamsxin Let us move this code to Phalcon\Config\Adapter\Php

Something like this:

namespace Phalcon\Config\Adapter;
class Php
{
    public fucntion __construct($file)
    {
        if (file_exists($file)) {
            parent::__construct(require($file));
        }
        else {
            throw new \Phalcon\Config\Exception(sprintf("File %s does not exist", $file));
        }
    }
}

but in C :-)

@dreamsxin
Copy link
Contributor Author

OK

phalcon pushed a commit that referenced this pull request Oct 25, 2013
[NFR]Config Support for reading PHP files
@phalcon phalcon merged commit 3fcdbc0 into phalcon:1.3.0 Oct 25, 2013
@phalcon
Copy link
Collaborator

phalcon commented Oct 25, 2013

Great addition

@dreamsxin dreamsxin deleted the config branch August 20, 2014 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants