# Can I create two app with a single installation of slim?

**URL:** <https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112>\
**Category:** Site Feedback\
**Created:** [April 24, 2019, 6:13pm UTC](https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112 "2019-04-24T18:13:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Testosiste](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Testosiste](https://discourse.slimframework.com/u/Testosiste)\
**Post date:** [April 24, 2019, 6:13pm UTC](https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112/1 "2019-04-24T18:13:42Z")

</div>

Hello guys, how are you going ? I hope well!

So i want to ask something…

I have installed my slim 3 and i have coded my api with it for my android app.

And then i want to create a website(app) with a view… Is possible to create another instance of the slim app ?

 ![slim](https://canada1.discourse-cdn.com/flex030/uploads/slimframework/original/1X/4a4db94a2653c3d893edec95db2a562fab43fc36.png)  
In the “api/v1” folder, i have my first instance  
In the root path, i want to have the second

Possible ?

---

<div class="post-metadata">

**Author:** ![Antnee](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Antnee](https://discourse.slimframework.com/u/Antnee)\
**Post date:** [April 24, 2019, 6:50pm UTC](https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112/2 "2019-04-24T18:50:10Z")

</div>

Yes, absolutely. In fact, I’ve done something similar at work. Configure the app with different settings in your index.php, probably different routes?

I’d show you an example, but I’m responding on my phone. Hopefully that still helps

---

<div class="post-metadata">

**Author:** ![Testosiste](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Testosiste](https://discourse.slimframework.com/u/Testosiste)\
**Post date:** [April 24, 2019, 6:54pm UTC](https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112/3 "2019-04-24T18:54:56Z")

</div>

Yes, different routes…

Ok, Antnee; i can wait you, please show me your example when you will be with your computer…

I’m waiting…

---

<div class="post-metadata">

**Author:** ![Antnee](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Antnee](https://discourse.slimframework.com/u/Antnee)\
**Post date:** [April 25, 2019, 8:07am UTC](https://discourse.slimframework.com/t/can-i-create-two-app-with-a-single-installation-of-slim/3112/4 "2019-04-25T08:07:49Z")

</div>

Well I don’t know what your index.php looks like, but if they both look something like this:

```php
<?php
use Slim\App;

require_once '../vendor/autoload.php';
$app = new App();

$app->get('/', Your\Apps\IndexAction::class);
$app->get('/foo', Your\Apps\FooAction::class);

$app->run();

```

Then you just define different routes. We have ours in different files which we include, but the basic idea is the same. The core app is the same thing, but we can use different routes and actions so that the two appear to be different apps, even though it’s the same code base. You may have different dependency resolution, I don’t know… but it’s quite possible, and it’s not terribly difficult.

I can see that you’re using Docker Compose, too. We also do this, and we have one container build that maps the public directory to one _app’s_ index.php, and the other container maps to the other.

Incidentally, now I’m on a larger screen, I notice that you have an index.php in the root of the project. You really ought to have it in a subdirectory so that it’s not possible for someone to request sensitive files. If I were to go to `/composer.json` on your second app I’d be able to view the contents of the file, for example. You don’t want to do that
