Toggle sidebar
Integrating Tighten Takeout with Laravel — Centralize and Simplify Local Services

Integrating Tighten Takeout with Laravel — Centralize and Simplify Local Services

When you manage multiple Laravel projects, each one often runs its own MySQL, Redis, or Meilisearch container. Over time, that can lead to high RAM usage, port conflicts, and duplicated configurations.

If that sounds familiar, Tighten Takeout is the solution you’ve been looking for.


🍔 What Is Tighten Takeout?

Takeout is a simple CLI tool that helps developers manage common development services — like MySQL, Redis, PostgreSQL, and Meilisearch — via Docker.

Instead of running these services inside every Laravel project, Takeout runs them globally, so you can share them across projects.

That means:

  • One MySQL instance for all your apps

  • One Redis cache service

  • Less RAM usage

  • Cleaner Docker setups

Each Takeout service runs inside its own Docker container, all connected through a shared network named takeout.


⚙️ Installing Takeout

You can install Takeout globally via Composer:

composer global require tightenco/takeout

Then make sure the Composer global bin directory is in your system PATH:

export PATH="$HOME/.composer/vendor/bin:$PATH"

Now you can use the takeout command anywhere:

takeout

🚀 Starting Services with Takeout

Once installed, you can quickly spin up shared services:

takeout enable mysql
takeout enable redis
takeout enable meilisearch

You can view all running services:

takeout list

And stop one when you no longer need it:

takeout disable mysql

Each service runs on its own Docker container and automatically joins a special Docker network called takeout.


🔗 Connecting Laravel (or Sail) to Takeout

If you’re using Laravel Sail, you can integrate it with Takeout easily so that your Laravel container can use the shared services.

1. Add the takeout Network to Docker Compose

Open your project’s docker-compose.yml and add the takeout network definition:

networks:
  sail:
    driver: bridge
  takeout:
    external:
      name: takeout

Then, attach your Laravel container to this external network.
For example:

services:
  laravel.test:
    build:
      context: ./vendor/laravel/sail/runtimes/8.2
      dockerfile: Dockerfile
    image: sail-8.2/app
    ports:
      - '80:80'
    networks:
      - sail
      - takeout

This tells Docker that your app container should also join the takeout network — allowing it to communicate directly with any Takeout-managed services.

Rebuild and restart Sail afterward:

./vendor/bin/sail build --no-cache
./vendor/bin/sail up -d

2. Configure Laravel’s .env File

Now that your Laravel container is on the same Docker network as Takeout, you can point your app to those shared services:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_user
DB_PASSWORD=your_password

REDIS_HOST=redis
REDIS_PORT=6379

You can find the correct hostnames and ports by running:

takeout list

For example, if you see:

+--------------------------------------+-------------+----------------+
| Names                                | Base Alias  | Full Alias     |
+--------------------------------------+-------------+----------------+
| TO--mysql--8.0--3306                 | mysql       | mysql8.0       |
+--------------------------------------+-------------+----------------+

You can use either mysql or mysql8.0 as the DB_HOST value.


💡 Why Use Takeout with Laravel

  • 🧠 Centralized service management — one MySQL, one Redis, shared by all projects

  • ⚙️ Lower memory footprint — fewer containers per project

  • 🧹 Simpler Docker setup — no duplicate configuration

  • 🧩 Seamless integration — Sail and Takeout can communicate over the takeout network

  • 🚀 Faster onboarding — just enable a service and connect

This approach keeps your Laravel projects lightweight while maintaining full flexibility and consistency.