Download the PHP package sabat24/markdown-table without Composer

On this page you can find all versions of the php package sabat24/markdown-table. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package markdown-table

markdown-table

Generate a markdown (GFM) table in PHP.

Contents

What is this?

This is a simple package that takes table data and generates a GitHub flavored markdown (GFM) table in PHP.

When should I use this?

You can use this package when you want to generate the source code of a GFM table from PHP data structures.

Inspiration

This is a PHP implementation inspired by the JavaScript wooorm/markdown-table package with similar API and functionality.

I also made it compatible with the-kbA-team/markdown-table because I use this package in some projects.

Install

In PHP projects, install with Composer:

Use

Typical usage (defaults to align left):

Yields:

With align:

Yields:

With automatic headers:

Yields:

With custom string length function:

With allowed HTML tags:

Yields:

API

Table Class

__construct(array $columnNames = [], array $options = [], bool $useNamesAsPositions = false)

Creates a new table with:

addColumn(int|string $pos, Column $column): Table

Adds a column to the table at the specified position.

getColumn(int|string $pos): Column

Retrieves a column at the specified position.

clearColumns(): Table

Removes all columns from the table.

hasColumn(int|string $pos): bool

Checks if a column exists at the specified position.

hasColumns(): bool

Checks if the table has any columns defined.

dropColumn(int|string $pos): Table

Removes a column at the specified position.

setStringLengthFunction(callable $callback): Table

Sets a custom function to determine the visual length of strings, useful for handling CJK characters and emoji.

setAlignment(array|string $align): Table

Sets alignment for columns. Accepts:

setOptions(array $options): Table

Sets configuration options for the table.

getOptions(): array

Gets current configuration options.

getString(array $rows): string

Generates a Markdown table string from the given rows.

Column Class

__construct(string $title, ?int $alignment = null)

Creates a new column with the specified title and optional alignment.

setAlignmentFromString(?string $alignment): Column

Sets the column alignment using a string:

Options

The following options can be passed to the Table constructor or setOptions() method:

alignDelimiters (bool, default: true)

Whether to align the delimiters. When true, they are aligned; when false, they are staggered.

padding (bool, default: true)

Whether to add a space of padding between delimiters and cells.

delimiterStart (bool, default: true)

Whether to begin each row with the delimiter.

delimiterEnd (bool, default: true)

Whether to end each row with the delimiter.

autoHeaders (bool, default: false)

Whether to use the first row of data as headers.

headerSeparatorPadding (bool, default: false)

Whether to add padding spaces in the header separator row.

allowedTags (array, default: [])

An array of HTML tags that should be preserved in the output. By default, all HTML is escaped, but you can specify tags like ['br', 'strong', 'em'] to allow these tags to remain unescaped in the generated table.

Compatibility

This package requires PHP 8.2 or higher.


All versions of markdown-table with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sabat24/markdown-table contains the following files

Loading the files please wait ...