library symlink-detective
Library allows to determine realpath to your script when you try to do it from symlinked file
and/symlink-detective
Library allows to determine realpath to your script when you try to do it from symlinked file
- Thursday, November 16, 2017
- by And
- Repository
- 1 Watchers
- 0 Stars
- 465 Installations
- PHP
- 2 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 3 Versions
- 12 % Grown
SymlinkDetective - real detective for unreal paths
, (*1)
Hey, this library is allows you to find the real path from all that mess, if you use symlinks for some directories in your project.
Just and example:, (*2)
- Project root dir:
/var/www/sites/your-project
-
/var/www/sites/your-project/library
is pointed to /var/www/libs/library
-
/var/www/sites/your-project/public
with app.php inside is pointed to /var/www/libs/frontend
(so /var/www/sites/your-project/public/app.php
is pointed to /var/www/libs/frontend/app.php
)
If somewhere in library (/var/www/libs/library
) you do reference to some path like library/../app/config.php
- your path be equal to /var/www/libs/library/../app/config
== /var/www/libs/app/config
, and guess - paths is not exists., (*3)
But there is solution - you can call SymlinkDetective::detectPath(__DIR__ . '/../app/config')
and mr. SymlinkDetective will do the magic, (*4)
Examples, (*5)
-
SymlinkDetective::detectPath(__DIR__ . '/../app/config')
returns /var/www/sites/your-project/app/config
-
SymlinkDetective::detectPath(__FILE__, '/../app/config')
returns /var/www/sites/your-project/app/config
-
SymlinkDetective::detectPath(__FILE__, '/../app/unexistent-file', false)
throws an Exception as file doesn't found/exists
-
SymlinkDetective::detectPath(__DIR__ . '/../unexistent-file')
returns /var/www/libs/library/unexistent-file
as file not found and Exception throwing is muted (3rd argument)
v0.7.x-dev
0.7.9999999.9999999-dev
Library allows to determine realpath to your script when you try to do it from symlinked file
Sources
Download
The Requires
by
And
dev-master
9999999-dev
Library allows to determine realpath to your script when you try to do it from symlinked file
Sources
Download
The Requires
by
And
0.5
0.5.0.0
Library allows to determine realpath to your script when you try to do it from symlinked file
Sources
Download
The Requires
by
And