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

<pre><code>public function init()
{
    $otherCraftApp = require '/path/to/other/bootstrap.php';
    $otherCraftHttpRequestService = $otherCraftApp-&gt;request;
}
</code></pre>

CC BY-SA 3.0
2014-09-09T11:36:40.113Z
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
CC BY-SA 3.0
2014-09-09T14:49:20.147Z
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
CC BY-SA 3.0
2014-09-09T15:24:40.193Z
Yes, separate `index.php`, config, template and plugin files.
Victor
CC BY-SA 3.0
2014-09-11T06:21:29.947Z
Doesn't this break the licensing?
Luke Holder
CC BY-SA 3.0
2014-09-11T15:08:29.890Z
@LukeHolder Each instance has its own `config` folder, with its own `license.key` file, so it doesn't break the licensing.
Victor
CC BY-SA 3.0
2014-09-09T00:43:16.687Z
2014-09-09T00:43:16.687Z
Brad Bell
<p>As I am not able to comment I am leaving a braindump...</p>

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

<p>If that is the case:<br>
I was looking at that already as well but found utilizing a cron job or puppet script be more<br>
- secure and controllable (also in case a developer leaves the company)<br>
- scalable in regards to performance and security also accross   systems/clusters/dokku boxes)<br>
- 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)</p>

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

CC BY-SA 3.0
2014-09-14T17:02:07.800Z
2014-09-14T17:31:10.737Z
2014-09-14T17:31:10.737Z
frank
<p>I'm currently writing a plugin which should connect to another Craft Instance (same server, same <code>app</code> folder) and run some code (start a task or execute a service function).</p>

<p>I looked at the <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/bootstrap.php" rel="nofollow"><code>bootstrap.php</code></a> which looks great, but I can't include it inside the plugin, or can I somehow?</p>

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

<plugin-development><bootstrap-craft>
How to bootstrap / connect to another Craft instance from inside a plugin?
# How to bootstrap / connect to another Craft instance from inside a plugin?

(Asked by: username_0 on 2014-09-08)

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`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/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?

**Tags:** plugin-development, bootstrap-craft

---

## 2 answers

### Answer by username_1 on 2014-09-09. Score: 1

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;
}

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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?  
> **username_0**: Yes, separate `index.php`, config, template and plugin files.  
> **username_2**: Doesn't this break the licensing?  
> **username_0**: @LukeHolder Each instance has its own `config` folder, with its own `license.key` file, so it doesn't break the licensing.  

---

### Answer by username_3 on 2014-09-14. Score: 1

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.


---

