Use Kirby in "non-Kirby files"

Is there any way to use Kirby functions in PHP files that aren’t “default” of Kirby? I have a PHP generates CSS File where I want to use some of the default Kirby methods like get(); and some own functions I’ve added in a plugin.

I have in mind that I’ve read somewhere such a situation and there was something with require bootstrap.php'; or similar


Thanks! Maybe this is a beginner PHP Question but my PHP File is in a totally different folder and the __DIR__ references to this folder. Is there a best practice way to get this file?

Then you have to pass the correct path to the file, either absolute or relative to the current folder.

If someone is interested, here’s how to get parents of __DIR__ (PHP > 7 only):

// 2 directories up
require dirname(__DIR__, 2) . '/kirby/bootstrap.php';