Download the PHP package loilo/lowlight without Composer

On this page you can find all versions of the php package loilo/lowlight. 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 lowlight

Lowlight

Tests Packagist

Lowlight shows syntax-highlighted code of 150+ languages in your terminal. It's built on top of highlight.php.

Installation

This package is available via Composer. To add it to your project, just run:

Usage

Preconditions

If you're not running Lowlight in a framework context, you may need to initialize Composer's autoloading first:

Getting Started

To highlight a piece of PHP code, do this:

There are a lot of languages available. See the full list here.

Automatic Language Detection

If you're handling user-provided code, you may not always know the used language. That's where auto detection comes into play.

Let's say we got configuration code, but we aren't sure if it's JSON, YAML or INI, then the following approach would highlight it appropriately:

The second argument to the highlightAuto() method are the languages the code will be checked against.

Theming

Theming works in analogy to highlight.js' theming. Highlight.js represents each token as CSS class name (e.g. hljs-comment) while Lowlight uses the tokens as keys in a theming array:

As you can see, styling is quite limited in the terminal. Lowlight only allows you to set a token's text color, nothing else. Therefore, you usually won't be able to create the same amount of atmosphere through a theme as you can do in CSS (except, maybe, when using arbitrary RGB colors).

Colors

Available colors are:

RGB Colors

Many modern terminals do support a 24-bit color palette. Instead of using the 16ish oldschool color names, you can provide an RGB array for a token:

If you want to use those, detecting support for 24-bit colors (as with all color-related features) is up to you.

Custom themes

To roll your own theme, it's a viable approach to take an existing highlight.js theme, extract all .hljs-xxx classes and transform them to a PHP associative array.

Note: You usually don't know the general style of the user's terminal and how your theme integrates with that (most notably if they're using a dark or a light theme), so be careful and restrictive with the colors you use.

By the way, this is Lowlight's default theme:

Credit


All versions of lowlight with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.2
scrivo/highlight.php Version ^9.12
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 loilo/lowlight contains the following files

Loading the files please wait ....