Convert Figma logo to code with AI

tighten logotakeout

Docker-based development-only dependency manager. macOS, Linux, and WSL2-only and installs via PHP's Composer... for now.

1,593
83
1,593
12

Top Related Projects

78,107

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

A package to backup your Laravel app

Debugbar for Laravel (Integrates PHP Debug Bar)

32,329

The Laravel Framework.

Associate users with roles and permissions

⚗️ Adds code analysis to Laravel improving developer productivity and code quality.

Quick Overview

Takeout is a PHP package that simplifies the process of exporting data from Laravel applications. It provides a convenient way to generate CSV exports of Eloquent models, allowing developers to easily create data export functionality in their Laravel projects.

Pros

  • Easy integration with Laravel applications
  • Flexible configuration options for customizing exports
  • Supports exporting relationships and custom attributes
  • Handles large datasets efficiently through chunking

Cons

  • Limited to CSV format exports
  • Requires Laravel framework, not usable in other PHP projects
  • May require additional setup for complex data structures
  • Documentation could be more comprehensive

Code Examples

  1. Basic export of a model:
use Tightenco\Takeout\Takeout;

$takeout = new Takeout();
$takeout->export(User::class);
  1. Exporting specific columns:
$takeout->export(User::class, ['id', 'name', 'email']);
  1. Exporting with relationships:
$takeout->export(Post::class, ['id', 'title', 'author.name']);
  1. Customizing the export query:
$takeout->export(User::class, function ($query) {
    return $query->where('active', true)->orderBy('created_at', 'desc');
});

Getting Started

  1. Install the package via Composer:
composer require tightenco/takeout
  1. Use the Takeout class in your Laravel application:
use Tightenco\Takeout\Takeout;

$takeout = new Takeout();
$takeout->export(YourModel::class);
  1. The exported CSV file will be saved in the storage/app directory by default. You can customize the storage path in the Takeout configuration.

Competitor Comparisons

78,107

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

Pros of Laravel

  • Full-featured web application framework with extensive built-in functionality
  • Large ecosystem with numerous packages and extensions available
  • Comprehensive documentation and strong community support

Cons of Laravel

  • Steeper learning curve for beginners due to its extensive features
  • Potentially heavier and more resource-intensive for simple projects
  • Requires more setup and configuration compared to lightweight alternatives

Code Comparison

Laravel (routes/web.php):

Route::get('/', function () {
    return view('welcome');
});

Takeout (routes/web.php):

Route::get('/', function () {
    return 'Hello, World!';
});

Laravel is a full-featured PHP web application framework, while Takeout is a lightweight Laravel-based starter kit for building SaaS applications. Laravel provides a comprehensive set of tools and features for building complex web applications, whereas Takeout focuses on simplifying the process of creating SaaS products with Laravel.

Laravel offers more out-of-the-box functionality and a larger ecosystem, making it suitable for a wide range of projects. Takeout, on the other hand, provides a streamlined approach with pre-configured features specifically tailored for SaaS applications, such as authentication, billing, and team management.

The code comparison shows that both projects use similar routing syntax, as Takeout is built on top of Laravel. However, Takeout may include additional pre-configured routes and views specific to SaaS functionality.

A package to backup your Laravel app

Pros of Laravel Backup

  • More comprehensive backup solution, including database and file backups
  • Offers built-in cleanup of old backups and notifications
  • Highly configurable with extensive documentation

Cons of Laravel Backup

  • Focused solely on Laravel applications, less flexible for other PHP projects
  • Requires more setup and configuration compared to Takeout's simplicity
  • May be overkill for simple projects or development environments

Code Comparison

Laravel Backup configuration:

return [
    'backup' => [
        'name' => 'my-app-backup',
        'source' => [
            'files' => [
                'include' => [base_path()],
                'exclude' => ['/vendor', '/node_modules'],
            ],
            'databases' => ['mysql'],
        ],
        'destination' => ['disks' => ['s3']],
    ],
];

Takeout usage:

takeout enable mysql
takeout enable redis
takeout disable elasticsearch

Laravel Backup is a more robust solution for production environments, offering comprehensive backup features and management. Takeout, on the other hand, focuses on simplifying local development environments by providing easy-to-use Docker containers for various services. While Laravel Backup requires more setup, it offers greater control and flexibility for backup strategies. Takeout excels in its simplicity and ease of use for developers working on local machines, but lacks the backup functionality provided by Laravel Backup.

Debugbar for Laravel (Integrates PHP Debug Bar)

Pros of Laravel Debugbar

  • Provides real-time debugging information directly in the browser
  • Offers detailed performance metrics, including database queries and memory usage
  • Integrates seamlessly with Laravel, providing framework-specific insights

Cons of Laravel Debugbar

  • Limited to Laravel applications, unlike Takeout's broader scope
  • May impact application performance when enabled in production environments
  • Requires manual configuration and setup in each project

Code Comparison

Laravel Debugbar:

use Barryvdh\Debugbar\Facade as Debugbar;

Debugbar::info('Info message');
Debugbar::error('Error message');
Debugbar::warning('Warning message');

Takeout:

// No direct code comparison available as Takeout is a Docker-based
// development environment tool, not a debugging library

Summary

Laravel Debugbar is a powerful debugging tool specifically designed for Laravel applications, offering real-time insights and performance metrics. It excels in providing detailed information about application execution, database queries, and memory usage. However, it's limited to Laravel projects and may impact performance if not used carefully.

Takeout, on the other hand, is a Docker-based tool for managing development dependencies, offering a broader scope beyond Laravel. It simplifies the setup of various services like databases and caching systems, making it useful for diverse project types. While it doesn't provide direct debugging capabilities, Takeout streamlines the development environment setup process.

32,329

The Laravel Framework.

Pros of Laravel Framework

  • Comprehensive full-stack framework with extensive features and tools
  • Large, active community providing support and resources
  • Well-documented with extensive official and community-created guides

Cons of Laravel Framework

  • Steeper learning curve for beginners due to its extensive feature set
  • Potentially overkill for small, simple projects
  • Requires more server resources compared to lightweight alternatives

Code Comparison

Laravel Framework:

Route::get('/users', function () {
    return User::all();
});

Takeout:

$takeout = new Takeout();
$takeout->add('mysql');
$takeout->install();

Summary

Laravel Framework is a comprehensive PHP web application framework, offering a wide range of features and tools for building complex applications. It has a large community and extensive documentation but may be overwhelming for beginners or small projects.

Takeout, on the other hand, is a lightweight tool focused on simplifying the setup of development environments using Docker. It's easier to use for beginners but has a more specific purpose compared to Laravel Framework's broad functionality.

Choose Laravel Framework for full-featured web applications, and Takeout for streamlining local development environment setup.

Associate users with roles and permissions

Pros of Laravel Permission

  • More focused on role-based access control (RBAC) for Laravel applications
  • Offers a more granular and flexible permission system
  • Provides built-in caching for improved performance

Cons of Laravel Permission

  • Limited to Laravel framework, while Takeout is more versatile
  • Requires more setup and configuration compared to Takeout's simpler approach
  • May have a steeper learning curve for beginners

Code Comparison

Laravel Permission:

$user->givePermissionTo('edit articles');
$user->assignRole('writer');
$user->hasPermissionTo('edit articles');

Takeout:

$takeout = new Takeout();
$takeout->add('users', 'mysql');
$takeout->start();

Summary

Laravel Permission is a specialized package for managing roles and permissions in Laravel applications, offering granular control and performance optimizations. Takeout, on the other hand, is a more general-purpose tool for setting up development environments across different technologies. While Laravel Permission provides robust RBAC features, Takeout excels in simplifying the setup of various services for local development. The choice between the two depends on the specific needs of your project and development workflow.

⚗️ Adds code analysis to Laravel improving developer productivity and code quality.

Pros of Larastan

  • Provides static analysis for Laravel applications, enhancing code quality and catching potential errors
  • Integrates seamlessly with PHPStan, offering powerful type inference and checks
  • Supports custom PHPStan rules and extensions for Laravel-specific functionality

Cons of Larastan

  • Requires more setup and configuration compared to Takeout's simpler approach
  • May have a steeper learning curve for developers new to static analysis tools
  • Can potentially produce false positives in certain complex Laravel scenarios

Code Comparison

Larastan configuration example:

<?php

use NunoMaduro\Larastan\LarastanServiceProvider;

return [
    'includes' => [
        base_path('vendor/nunomaduro/larastan/extension.neon'),
    ],
    'parameters' => [
        'level' => 5,
    ],
];

Takeout usage example:

takeout enable mysql
takeout disable redis
takeout start elasticsearch

While Larastan focuses on static analysis for Laravel applications, Takeout is a Docker-based development environment tool. They serve different purposes in the Laravel ecosystem, making a direct comparison challenging. Larastan aims to improve code quality through static analysis, while Takeout simplifies the setup of development dependencies using Docker containers.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Takeout - Docker-based dependency management

Takeout

Run tests Lint Latest Version on Packagist Downloads on Packagist

Takeout is a CLI tool for spinning up tiny Docker containers, one for each of your development environment dependencies.

It's meant to be paired with a tool like Laravel Valet. It's currently compatible with macOS, Linux, Windows 10 and WSL2.

With takeout enable mysql you're running MySQL, and never have to worry about managing or fixing Homebrew MySQL again.

But you can also easily enable ElasticSearch, PostgreSQL, MSSQL, Mongo, Redis, and more, with a simple command. For a current list of services, look at the classes available in this directory: https://github.com/tighten/takeout/tree/main/app/Services

Requirements

Installation

Install Takeout with Composer by running:

composer global require "tightenco/takeout:~2.8"

Make sure the ~/.composer/vendor/bin directory is in your system's "PATH".

Usage

Run takeout and then a command name from anywhere in your terminal.

One of Takeout's primary benefits is that it boots ("enables") or deletes ("disables") Docker containers for your various dependencies quickly and easily.

Because Docker offers persistent volume storage, deleting a container (which we call "disabling" it) doesn't actually delete its data. That means you can enable and disable services with reckless abandon.

Enable a service

Show a list of all services you can enable.

takeout enable

Enable specific services

Passed the short name of one or more services, enable them.

takeout enable mysql

takeout enable redis meilisearch

Enable services with default parameters

If you want to skip over being asked for each parameter and just accept the defaults. This also works with multiple services in one command.

takeout enable mysql --default

takeout enable redis meilisearch --default

Passthrough Container Arguments

You may specify extra arguments to the container after a -- sepatator:

takeout enable mysql -- -hsome.mysql.host -usome-user

Notice that these are arguments for the container Entrypoint, not extra docker run options (see below).

Extra docker run Options

Under the hood, the takeout enable command generates a docker run command. Sometimes you may want to specify extra options to the docker run command such as an extra environment variable or an extra volume mapping. You can pass a string with all the extra docker run options using the --run= option:

takeout enable mysql --run="{docker-run-options}"

Which would generate the following command:

docker run {docker-run-options} {service-options} mysql/mysql-server

Where {docker-run-options} are the options you specify inside the --run option and {service-options} are generated based on the default options for that service.

Mixing docker run Options With Container Arguments

You may mix and match the run options with the container arguments:

takeout enable mysql --run="{docker-run-options}" -- -hsome.mysql.host -usome-user

Disable a service

Show a list of all enabled services you can disable.

takeout disable

Disable specific services

Passed the short name of one or more services, disable the enabled services that match them most closely.

takeout disable mysql

takeout disable redis meilisearch

Disable all services

takeout disable --all

Start a stopped container

Show a list of all stopped containers you can start.

takeout start

Start specific stopped containers

Passed the container ID of one or more stopped containers, start the stopped containers that matches them.

takeout start {container_id}

takeout start {container_id1} {container_id2}

Start all containers

You may pass the -all flag to start all enabled containers.

takeout start --all

Stop a running container

Show a list of all running containers you can stop.

takeout stop

Stop specific running containers

Passed the container ID of one or more running containers, stop the running containers that matches them.

takeout stop {container_id}

takeout stop {container_id1} {container_id2}

Running multiple versions of a dependency

Another of Takeout's benefits is that it allows you to have multiple versions of a dependency installed and running at the same time. That means, for example, that you can run both MySQL 5.7 and 8.0 at the same time, on different ports.

Run takeout enable mysql twice; the first time, you'll want to choose the default port (3306) and the first version (5.7), and the second time, you'll want to choose a second port (3307), the second version (8.0) and a different volume name (so that they don't share the same mysql_data).

Now, if you run takeout list, you'll see both services running at the same time.

+--------------+----------------+---------------+-----------------------------------+
| CONTAINER ID | NAMES          | STATUS        | PORTS                             |
+--------------+----------------+---------------+-----------------------------------+
| 4bf3379ab2f5 | TO--mysql--5.7 | Up 2 seconds  | 33060/tcp, 0.0.0.0:3306->3306/tcp |
| 983acf46ceef | TO--mysql--8.0 | Up 35 seconds | 33060/tcp, 0.0.0.0:3307->3306/tcp |
+--------------+----------------+---------------+-----------------------------------+

Network Details

Takeout containers are automatically added to a Docker network named takeout. This allows you to use the same aliasing and base aliasing that is used for the other containers.

Each container is given two aliases on this network:

  • A base_alias based on the core dependency name (e.g. mysql, postgres)
  • A full_alias combining the base alias and version (e.g. mysql8.0, postgres13)

Other containers on the takeout network can access Takeout containers by their aliases. Check this article on how you can use sail and takeout together

FAQs

Will this enable the PHP drivers for me via PECL?

Sadly, no.

If I disable a service but Takeout still shows the port as taken, how do I proceed?

First, run lsof -i :3306 (where 3306 is the port that's unavailable.)

If you see output like this:

com.docke   936 mattstauffer   52u  IPv6 0xc0d6f0b06d5c4efb      0t0  TCP localhost:mysql->localhost:62919 (FIN_WAIT_2)
TablePlus 96155 mattstauffer   16u  IPv4 0xc0d6f0b0b6dccf6b      0t0  TCP localhost:62919->localhost:mysql (CLOSE_WAIT)

The solution is to just close your database GUI, and then it should be released.

Why would you use this instead of `docker-compose`?

Using docker-compose sets up your dependencies on a project-by-project basis, which is a perfectly fine way to do things. If it makes more sense to you to have a single copy of each of your dependencies for your entire global environment, Takeout makes more sense.

Will disabling a service permanently delete my databases?

Nope! Your data will stick around! By default almost all of our services use a "volume" to attach your data to for exactly this reason.

So, when you disable the MySQL service, for example, that volume--with all your data in it--will just sit there quietly. And when you re-enable, as long as you attach it to the same volume, all your data will still be there.

Future plans

The best way to see our future plans is to check out the Projects Board, but here are a few plans for the future:

  • Electron-based GUI
  • self-remove command: Deletes all enabled services and then maybe self-uninstalls?
  • upgrade: destroys the old container, brings up a new one with a newly-specified tag (prompt user for it, default latest) and keeps all other parameters (e.g. port, volume) exactly the same as the old one
  • pt/passthrough: proxy commands through to docker (./takeout pt mysql stop)
  • Deliver package in a way that's friendly to non-PHP developers (Homebrew? NPM?)
  • Allow other people to extend Takeout by adding their own plugins (thanks to @angrybrad for the idea!)

Process for release

If you're working with us and are assigned to push a release, here's the easiest process:

  1. Visit the Takeout Releases page; figure out what your next tag will be (increase the third number if it's a patch or fix; increase the second number if it's adding features)
  2. On your local machine, pull down the latest version of main (git checkout main && git pull)
  3. Build for the version you're targeting (php ./takeout app:build)
  4. Run the build once to make sure it works (php ./builds/takeout list)
  5. Commit your build and push it up
  6. Draft a new release with both the tag version and release title of your tag (e.g. v1.5.1)
  7. Use the "Generate release notes" button to generate release notes from the merged PRs.
  8. Hit Publish release
  9. Profit 😆