-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b3eaec
commit ef577a4
Showing
7 changed files
with
493 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Examples/ export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.idea/ | ||
/.vscode/ | ||
/.vs/ | ||
/vendor/ | ||
/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!usr/bin/php | ||
<?php | ||
declare(strict_types=1); | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
use InitPHP\CLITable\Table; | ||
|
||
$table = new Table(); | ||
|
||
$table->row([ | ||
'id' => 1, | ||
'name' => 'Matthew S.', | ||
'surname' => 'Kramer', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 2, | ||
'name' => 'Millie J.', | ||
'surname' => 'Koenig', | ||
'email' => '[email protected]', | ||
'status' => false, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 3, | ||
'name' => 'Regina G.', | ||
'surname' => 'Hart', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
echo $table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!usr/bin/php | ||
<?php | ||
declare(strict_types=1); | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
use InitPHP\CLITable\Table; | ||
|
||
$table = new Table(); | ||
$table->setBorderStyle(Table::COLOR_BLUE); | ||
$table->setCellStyle(Table::COLOR_GREEN); | ||
$table->setHeaderStyle(Table::COLOR_RED, Table::BOLD); | ||
|
||
$table->setColumnCellStyle('id', Table::ITALIC, Table::COLOR_LIGHT_YELLOW); | ||
$table->setColumnCellStyle('email', Table::BOLD, Table::ITALIC); | ||
|
||
$table->row([ | ||
'id' => 1, | ||
'name' => 'Matthew S.', | ||
'surname' => 'Kramer', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 2, | ||
'name' => 'Millie J.', | ||
'surname' => 'Koenig', | ||
'email' => '[email protected]', | ||
'status' => false, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 3, | ||
'name' => 'Regina G.', | ||
'surname' => 'Hart', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
echo $table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,109 @@ | ||
# CLITable | ||
PHP CLI Table | ||
# InitPHP CLI Table Generator | ||
|
||
This library allows you to create nice looking tables in the CLI interface with PHP. | ||
|
||
_**Note** : Not required, but the **MB_String** extension is highly recommended._ | ||
|
||
## Installation | ||
|
||
``` | ||
composer require initphp/cli-table | ||
``` | ||
|
||
or include `src/Table.php`. | ||
|
||
## Usage | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . "/vendor/autoload.php"; | ||
use \InitPHP\CLITable\Table; | ||
|
||
$table = new Table(); | ||
|
||
$table->row([ | ||
'id' => 1, | ||
'name' => 'Matthew S.', | ||
'surname' => 'Kramer', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 2, | ||
'name' => 'Millie J.', | ||
'surname' => 'Koenig', | ||
'email' => '[email protected]', | ||
'status' => false, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 3, | ||
'name' => 'Regina G.', | ||
'surname' => 'Hart', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
echo $table; | ||
``` | ||
|
||
Output : | ||
|
||
![basic-cli-table](https://user-images.githubusercontent.com/104234499/186993361-3917979a-0a40-4e7b-84e8-4dd5f51c1bd1.jpg) | ||
|
||
### Styled | ||
|
||
```php | ||
<?php | ||
declare(strict_types=1); | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
use InitPHP\CLITable\Table; | ||
|
||
$table = new Table(); | ||
$table->setBorderStyle(Table::COLOR_BLUE); | ||
$table->setCellStyle(Table::COLOR_GREEN); | ||
$table->setHeaderStyle(Table::COLOR_RED, Table::BOLD); | ||
|
||
$table->setColumnCellStyle('id', Table::ITALIC, Table::COLOR_LIGHT_YELLOW); | ||
$table->setColumnCellStyle('email', Table::BOLD, Table::ITALIC); | ||
|
||
$table->row([ | ||
'id' => 1, | ||
'name' => 'Matthew S.', | ||
'surname' => 'Kramer', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 2, | ||
'name' => 'Millie J.', | ||
'surname' => 'Koenig', | ||
'email' => '[email protected]', | ||
'status' => false, | ||
]); | ||
|
||
$table->row([ | ||
'id' => 3, | ||
'name' => 'Regina G.', | ||
'surname' => 'Hart', | ||
'email' => '[email protected]', | ||
'status' => true, | ||
]); | ||
|
||
echo $table; | ||
``` | ||
|
||
Output : | ||
|
||
![styled-cli-table](https://user-images.githubusercontent.com/104234499/186993365-82c0e55d-d572-45d2-a89a-5cf60c5c9fbe.jpg) | ||
|
||
|
||
## Credits | ||
|
||
- [Muhammet ŞAFAK](https://github.com/muhammetsafak) <<[email protected]>> | ||
|
||
## License | ||
|
||
Copyright © 2022 [MIT License](./LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "initphp/cli-table", | ||
"description": "PHP CLI Table Generator", | ||
"type": "library", | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"InitPHP\\CLITable\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Muhammet ŞAFAK", | ||
"email": "[email protected]", | ||
"role": "Developer", | ||
"homepage": "https://www.muhammetsafak.com.tr" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=7.2" | ||
} | ||
} |
Oops, something went wrong.