Sep 29, 2017
0
Level 1
Bootstrapping Lumen for scripts
I don't know if I'm thinking about this wrong, but as with any app, sometimes I find I need to write a script to grab data for a CSV, to update fields, whatever. So with a Lumen app, I figure I can create a scripts folder in the root, but within the scripts themselves, I'd like to take advantage of things like Eloquent, the models I've created, the local .env file. I'm wondering, do I need to import whatever content I need into each script I create, or can I somehow make use of what's already setup?
So far, I started with
require __DIR__.'/../vendor/autoload.php';
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
My instinct says boot what I need, but I wanted to check from more experienced minds.
Please or to participate in this conversation.