https://github.com/muetze42/markdown
https://github.com/muetze42/markdown
markdown markdown-table php
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/muetze42/markdown
- Owner: Muetze42
- License: mit
- Created: 2023-08-25T20:22:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-14T09:10:06.000Z (over 2 years ago)
- Last Synced: 2025-02-17T03:34:00.757Z (about 1 year ago)
- Topics: markdown, markdown-table, php
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Markdown
## Install
```
composer require norman-huth/markdown
```
## Markdown Table Generator
### Basic Usage
Create this table:
```markdown
| ID | Name |
|:---|:--------------|
| 1 | Administrator |
| 2 | User |
| 4 | Hugo |
```
#### Row for Row
```php
use NormanHuth\Markdown\Table;
$table = new Table();
$table->addCell('ID');
$table->addCell('Name');
$table->addRow([1, 'John Doe']);
$table->addRow([2, 'Johanna Doe']);
echo $table->render();
```
#### Array or `\Illuminate\Support\Collection`
```php
use NormanHuth\Markdown\Table;
$table = new Table();
$table->addCell('ID');
$table->addCell('Name');
$table->addRows(
[
[1, 'John Doe'],
[2, 'Johanna Doe'],
]
);
echo $table->render();
```
#### Laravel Model Collection
```php
use NormanHuth\Markdown\Table;
$table = new Table();
$table->addCell('ID');
$table->addCell('Name');
$table->addRows(\App\Models\User::all(['id', 'name']));
return $table->render();
```