I'm currently writing a plugin which should connect to another Craft Instance (same server, same app folder) and run some code (start a task or execute a service function).

I looked at the bootstrap.php which looks great, but I can't include it inside the plugin, or can I somehow?

So how can I bootstrap / connect to another Craft instance from inside my plugin?


I don't see why you wouldn't be able to load it up from your plugin.

public function init()
    $otherCraftApp = require '/path/to/other/bootstrap.php';
    $otherCraftHttpRequestService = $otherCraftApp->request;
  • Sadly this doesn't work, because it's the same app folder, so I'm basically including itself. Or do I have to create a bootstrap.php outside the app-folder for each instance?
    – Victor In
    Sep 9 '14 at 11:36
  • Ahh, missed the "share the same app folder" part. bootstrap.php is coded to assume it's living immediately inside of the app folder. I assume the two sites have separate public index.php files?
    – Brad Bell
    Sep 9 '14 at 14:49
  • Yes, separate index.php, config, template and plugin files.
    – Victor In
    Sep 9 '14 at 15:24
  • Doesn't this break the licensing? Sep 11 '14 at 6:21
  • @LukeHolder Each instance has its own config folder, with its own license.key file, so it doesn't break the licensing.
    – Victor In
    Sep 11 '14 at 15:08

As I am not able to comment I am leaving a braindump...

I assume you try to trigger actions/tasks whatever in a environment like devmaster <-- dev, a dev <-- stage or something similar.

If that is the case:
I was looking at that already as well but found utilizing a cron job or puppet script be more
- secure and controllable (also in case a developer leaves the company)
- scalable in regards to performance and security also accross systems/clusters/dokku boxes)
- more reliable and granular as it allows more detailed logging/repoting options in case of a failure (snapin for the dashboard could utilize system logs and related data, you just need a template and no conversion)

As I am still in a concept phase for my project, I cant provide a working sample yet, sorry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.