josepmra
josepmra

Reputation: 627

Zend framework 2 configuration uses

I would like know what's the difference between the uses of global.php and local.php files. In the Zend documentation, these files only register the database configuration, but I don't understand because the credentials are in a separated file (local.php).

Zend documentation talks about a version control system (VCS), but I don't understand because if these files are in a same directory, they don't have the same visibility inside VCS.

Thanks in advance.

Upvotes: 1

Views: 161

Answers (1)

Jurian Sluiman
Jurian Sluiman

Reputation: 13558

The idea they work with, is (in git terms) an ignore. If you watch the git repository for the Skeleton Application, you see there is a .gitignore file in that directory.

This means, if you use git as a VCS, all files except any file matching local.php or *.local.php will be commited into the VCS. Therefore, the local.php but also the my-foo.local.php files will be kept outside the VCS.

This is very useful for local configuration (e.g. you want to turn the cache off on your development machine) or credentials (database, email or api keys for 3rd party services). The content of the local config files can be stored or communicated via other means.

To answer your question: yes, they are in the same directory, but they are ignored for the VCS. If you work with svn, there is also a term called svn:ignore and other VCSes have similar features.

Upvotes: 2

Related Questions