I'm working on the chat software. For the sake of speed, all of the database calls are raw, pure sql, using built-in PHP functions like mysql_query(). The software lives in a directory that is in the same root directory where a Symfony project is. I want to get info from the yaml files in the Symfony system, files such as databases.yml and app.yml.
Fabien Potencier has written about making the Symfony components easy to include in projects outside of Symfony. How is this done?
The Symfony project is version 1.2.5
You just need to require sfYaml class and you're ready to go!
$databaseConfigFile = '/path/to/your/project/config/databases.yml';
$databaseConfig = sfYaml::load($databaseConfigFile);
please refer to [[LINK href="http://components.symfony-project.org/yaml/"]]http://components.symfony-project.org/yaml/[[/LINK]] for downloading, installing and using thee sfYaml component.
Shortly it's easy as :
// Download and extract somewhere sfYaml from http://components.symfony-project.org/
$array = = sfYaml::load('/path/to/file.yml');
PS : see as well those classes :
If your chat application is severely tied with your symfony application (and may want to use more stuff from symfony 1.2/1.4 then just the yaml data), then use Jakub's solution. Otherwise, use the standalone Yaml component from the Symfony2 project, as JuG has said.