How do you create a php.ini file or something similar for reconfiguring default php settings. I need to change
include __DIR__ . "/folder/file.php";
to something like
include "@/folder/file.php";
Can I do this in php with ini file?
I tried using functions returning concatination of the absolute path and the relative one, but it's way to ugly, same as using constants and concatinating, that's verbose
include path("views/file.php");
I know about
const $root = __DIR__;
include "$root/folder/file.php";
I need root to be just one symbol! otherwise it's clunky
You can't do this using php.ini file.
If you are using some sort of a framework or you are using OOP approach, consider utilizing Composer, which has autoloading capabilities.
Then, when you want to use class App/User, you just use use App/User;
and composer, utilizing spl_autoload_register(), does locating the file and loading it for you.