Download the PHP package lucinda/console without Composer

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

Lucinda Console

This API was created to give an ability of styling console responses so they are easy to read and pleasurable to see. It does this in two steps:

  1. Defining a platform to create and format texts via following classes:
    • Text: class encapsulating a text, able to be applied any of above three UNIX styling options:
      • BackgroundColor: enum encapsulating background colors UNIX console texts can have
      • ForegroundColor: enum encapsulating foreground colors UNIX console texts can have
      • FontStyle: enum encapsulating font styles UNIX console texts can have (eg: bold)
    • Table: class encapsulating a table, not able to include sub-tables
    • OrderedList: class encapsulating an ordered list, able to contain leaves that point to other ordered lists
    • UnorderedList: class encapsulating a unordered list, able to contain leaves that point to other unordered lists
  2. Defining a HTML-like templating language that points to above structures behind the scenes, helping developers to implement console frontend without programming via following tags:
    • <div>: same as HTML tag but only supporting style attribute.
    • <table>: same as HTML tag but with a number of restrictions
    • <ol>: same as HTML tag but with a number of differences and restrictions
    • <ul>: same as HTML tag, with equivalent differences and restrictions as <ol>
    • <span>: same as HTML tag
    • <u>: same as HTML tag
    • <b>: same as HTML tag
    • <i>: same as HTML tag
  3. Defining a class able to bind templated text at point #2 with structures at point #3 in order to build the final view:
    • Wrapper: class encapsulating a table

API requires no dependency other than PHP 8.1+ interpreter and SimpleXML extension. All classes inside belong to Lucinda\Console interface!

Example Usage

Console Templating Language

Console templating language supports a fraction of HTML standard, namely parts that are feasable in styling and formatting console text. Certain elements allow a style attribute that supports following CSS directives:

Div Tag

Binding to Text, works the same as HTML <div> tag with following restrictions:

Syntax example:

Table Tag

Binding to Table, works the same as HTML <table> tag with following restrictions:

Syntax example:

Ol Tag

Binding to OrderedList, works the same as HTML <ol> tag with following differences and restrictions:

Example:

Ul Tag

Binding to <ol>.

Span Tag

Works the same as HTML <span> with following restrictions:

Example:

B Tag

Works the same as HTML <b> with same restrictions as <span> tag! Equivalent to:

U Tag

Works the same as HTML <u> with same restrictions as <span> tag! Equivalent to:

^ Note the difference from HTML text-decoration: underline

I Tag

Works the same as HTML <i> with same restrictions as <span> tag! Equivalent to:

^ Note the difference from HTML font-style: italic

Reference Guide

Text

Class Lucinda\Console\Text implements Stringable and styles a UNIX console text, defining following public methods:

Method Arguments Returns Description
__construct string $text void Sets text to style
setFontStyle Lucinda\Console\FontStyle $style void Sets text style (eg: makes it bold) from input enum member.
setBackgroundColor Lucinda\Console\BackgroundColor $color void Sets text background color from input enum member.
setForegroundColor Lucinda\Console\ForegroundColor $color void Sets text foreground color from input enum member.
getOriginalValue void string Gets original text before styling
getStyledValue void string Gets final text after styling
toString void string Gets final string representation of text to be shown on console/terminal

Table

Class Lucinda\Console\Table implements Stringable and creates a table to be displayed on console/terminal, defining following public methods:

Method Arguments Returns Description
__construct array $columns void Sets table columns based on string or Text array input
addRow array $row void Adds a row to table based on string or Text array input
toString void string Gets final string representation of table to be shown on console/terminal

AbstractList

Abstract class Lucinda\Console\AbstractList implements Stringable and creates a list to be displayed on console/terminal, defining following public methods:

Method Arguments Returns Description
__construct int $indent = 0 void Constructs a list by number of spaces to indent in members (default=5)
setCaption string|Text $caption void Sets optional caption to define what list is about based on string or Text input
addItem string|Text $item void Adds a textual member to list based on string or Text input.
addList AbstractList void Adds a AbstractList member to list
toString void string Gets final string representation of list to be shown on console/terminal

and following abstract method children must implement:

Method Arguments Returns Description
formatOptionNumber int $optionNumber string Formats list option number for later display

OrderedList

Class Lucinda\Console\OrderedList extends AbstractList and creates an ordered list to be displayed on console/terminal.

UnorderedList

Class Lucinda\Console\UnorderedList extends AbstractList and creates an uordered list to be displayed on console/terminal.

Wrapper

Class Lucinda\Console\Wrapper compiles user-defined text using Console Templating Language by binding tags inside to their equivalent classes. It defines following public methods:

Method Arguments Returns Description
__construct string $body void Takes text received and compiles it
getBody void string Gets compiled body, ready to be displayed on console/terminal

If compilation fails, a Lucinda\Console\Exception is thrown!


All versions of console with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 lucinda/console contains the following files

Loading the files please wait ....