Download the PHP package kadet/keylighter without Composer

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

Logo

Packagist GitHub Actions GitHub Actions Try it

Yet another Syntax Highlighter in PHP meant to be as extensible and easy to use as it only can, but with performance in mind.

You can try it live with the most recent version on https://keylighter.kadet.net/.

Name

Name "KeyLighter" is inspired by Key Light concept in photography and cinematography.

The key light is the first and usually most important light a photographer, cinematographer, lighting cameraman, or other scene composer will use in a lighting setup. The purpose of the key light is to highlight the form and dimension of the subject.

KeyLighter is supposed to do the same thing - for code.

Installation

To use KeyLighter you just need PHP 7.3 or later, no special extensions required.

Global installation

It's possible to install KeyLighter as a global composer library

Then you can use builtin simple cli highlighting app:

If you want pipe into KeyLighter just specify php://stdin as path. You can use list command to see all available commands, and --help argument for detailed help. You don't have to specify highlight command explicitly.

PowerShell

You're using PowerShell on Windows? Cool! KeyLighter comes with integrated PowerShell module that makes CLI usage even better. Just import module (For example in profile), and you're ready to go.

To use autocompletion features you will need PowerShell v5 (Comes with windows 10) or install TabExpansion++ Module.

Powershell Support

Why KeyLighter?

Simple to use

You can find all available languages here and formatters here.

It works on CLI! And more!

KeyLighter was originally designed as CLI highlighter for my own usage, but then I decided that it should be able to generate any possible output, currently supported:

Cli \Kadet\Highlighter\Formatter\CliFormatter

CLI

It can even be styled, default styles are stored in Styles\Cli\Default.php, but you can just pass additional argument into a constructor:

HTML \Kadet\Highlighter\Formatter\HtmlFormatter

HTML

Every token is placed inside it's own span and classes are prefixed so it can be easily styled with css and should not interfere with any of your existing classes

Your own?

It's easy to write your own formatters. Documentation coming soon.

Context sensitive

Some tokens are valid in some contexts, some are not. This library is context sensitive, and you can define when they are valid.

In this case, context mean just "inside of other token", for example lets assume that string token is defined as everything from " to the next " and keyword is defined as 'sit' substring.

So as you can see keyword is inside of string, and therefore is not valid and should be deleted. You can define tokens valid only in some context, or invalid in other.

Oh, and token names cascade, it means that string.single is string, but string is necessarily not string.single.

Write your own language definitions easily

It's possible to easily extend KeyLighter with new languages, more detailed documentation coming soon.

For example XML definition looks like this:

I will try to write as many definitions as I only can, but any PRs are welcome.

Embedding languages

Many languages can be used simultaneously, css or js inside html, sql in
php and so on. KeyLighter can handle and highlight embedded languages without any problem.

Embedded languages

Fast

Even though it wasn't supposed to be fastest code highlighter in PHP it is still quite fast, more than 2x faster than GeSHi.

Testing

KeyLighter uses phpunit for testing:

Roadmap

There are still few things to do, you can find all on trello.

Contributing

See CONTRIBUTING.md for details.

Thanks

For Maciej, Maciej and Monika for all support, moral too.


All versions of keylighter with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
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 kadet/keylighter contains the following files

Loading the files please wait ....