Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Console Table

Console Table Laravel Package

phplucidframe/console-table

Lightweight PHP library to render formatted ASCII tables in the console. Define headers, rows, alignment, padding, and borders; supports styling and flexible layouts for CLI apps, scripts, and Symfony/Laravel-style console output.

View on GitHub
Deep Wiki
Context7

Console Table

Frequently asked questions about Console Table
How do I use ConsoleTable in a Laravel Artisan command?
Inject the package into your command class and initialize it with headers and rows. For example, create a new `ConsoleTable` instance, set headers like `['ID', 'Name', 'Status']`, then add rows using `addRows()` with an array of data. Finally, call `display()` to render the table in the terminal.
Does ConsoleTable support Laravel 10 or 11?
Yes, ConsoleTable is fully compatible with Laravel 10 and 11, as it only requires PHP 8.0+. No Laravel-specific dependencies mean it integrates seamlessly without version conflicts. Always test in your target environment for rendering consistency.
Can I customize column alignment or add borders to tables?
Yes, ConsoleTable allows you to control column alignment (left, right, or center) and supports ASCII/Unicode borders. You can configure these settings via methods like `setAlignment()` or `setBorderStyle()` before rendering. For advanced styling, you may need to extend the class or use ANSI color escapes.
Will this work in Windows Terminal or WSL?
ConsoleTable is designed to work across terminals, but rendering may vary slightly due to ANSI color support differences. Test on your target environment (e.g., Windows Terminal, WSL, or Linux) to ensure consistent output. If issues arise, use plain ASCII mode or adjust styling.
How do I handle large datasets (e.g., 5,000+ rows) without performance issues?
For large datasets, avoid loading all rows at once. Use pagination (e.g., `paginate()` in Laravel) or chunk the data into smaller batches. Stream output incrementally or implement lazy loading to prevent terminal buffer overflows or lag.
Is there a way to add colors or themes to tables?
ConsoleTable supports basic ANSI color escapes for text and background colors via methods like `setHeaderColor()` or `setRowColor()`. For more advanced theming, you’ll need to extend the class or manually apply ANSI codes to specific cells. Check the package’s documentation for available styling options.
How do I integrate ConsoleTable with Laravel Telescope?
Extend Telescope’s `TelescopeServiceProvider` to format query logs or data dumps as tables. Inject `ConsoleTable` into your custom panel or override Telescope’s output methods. For example, replace `dd($query->results)` with a `ConsoleTable` instance configured to display the results in a structured format.
What are the alternatives to ConsoleTable in Laravel?
For Laravel, consider Laravel’s built-in `Table` helper (from `illuminate/support`) or Symfony’s `Console/Helper/TableHelper`. ConsoleTable stands out for its simplicity and Laravel-specific use cases, like Artisan commands. Compare features like styling, performance, and ease of integration for your needs.
Can I use ConsoleTable in non-Laravel PHP projects (e.g., Symfony or CLI scripts)?
Absolutely. ConsoleTable is a standalone library with no Laravel dependencies, so it works anywhere PHP CLI is available. Install it via Composer and use it in Symfony commands, custom scripts, or any terminal-based application requiring tabular output.
How do I test ConsoleTable output in CI/CD pipelines?
Since terminal output is visual, use screenshot testing tools like `phpunit/phpunit-screenshot` to capture and compare table renders. Alternatively, validate output via string matching (e.g., check for expected headers or row counts) in your PHPUnit tests. Mock terminal output if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor