Download the PHP package castlegate/monolith-core without Composer

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

Monolith Core Module

Monolith is a collection of utility functions and classes that make PHP and WordPress development a little bit easier. The Core module can be used with any PHP project and uses the \Castlegate\Monolith\Core namespace.

Install

Monolith Core is available on Packagist and can be installed via Composer:

composer require castlegate/monolith-core

Functions

Classes

ScalableVectorGraphic

The ScalableVectorGraphic class sanitizes SVG code for embedding directly in HTML documents. By default, it removes the XML declaration and attempts to add a viewBox attribute if one is not already present.

$svg = new \Cgit\Monolith\Core\ScalableVectorGraphic;
$svg->parse($code); // import SVG code from string
$svg->load($file); // import SVG code from file

echo $svg->embed(); // return sanitized SVG code

You can also use it to remove attributes from the root element and to remove styles from the entire SVG. This may be useful for SVG icons where the fill colour should be set by the document CSS and not the CSS embedded in the SVG code.

$svg->removeAttributes('viewBox');
$svg->removeAttributes(['width', 'height']);
$svg->removeStyles('fill');
$svg->removeStyles(['fill', 'stroke']);

You can reset the SVG to its original condition using the reset() method. You can also return the original source code and the non-sanitized, parsed SVG code using the embedSourceCode() and embedSourceDom() methods respectively.

You can use the fill($color) method to set a fill attribute on the root SVG element. You can also use the title($title) method to set a title element for better accessibility.

TimeSpanner

The TimeSpanner class provides a convenient way of calculating and displaying consistently formatted ranges of dates or times. Its constructor sets the start and end dates, performing some sanitization of the input (integers are assumed to be Unix time; everything else gets fed through strtotime()).

$foo = new \Cgit\Monolith\Core\TimeSpanner($start, $end);

$foo->getStartTime($format); // e.g. "1 January 2010"
$foo->getEndTime($format);
$foo->getRange($formats, $tolerance); // e.g. "1-10 January 2010"
$foo->getInterval($formats, $tolerance); // e.g. "4 seconds" or "10 years"

You can set the tolerance in seconds for displaying ranges of times. If the difference between the start and end times is within the tolerance value, they are considered to be the same time.

$foo->setDefaultRangeTolerance($seconds);

Time formats can be specified when returning a value or as default values for this instance. Formats are specified in the standard PHP date format.

$foo->setDefaultTimeFormat('j F Y');
$foo->setDefaultRangeFormats([
    'time' => ['H:i', '–', 'H:i d F Y'],
    'day' => ['d', '–', 'd F Y'],
    'month' => ['d F', '–', 'd F Y'],
    'year' => ['d F Y', '–', 'd F Y'],
]);

Video

The Video class takes any approximately valid YouTube or Vimeo URL or embed code and provides access to URLs, embed codes, images, and links.

$foo = new \Cgit\Monolith\Core\Video($code);

$foo->url(); // video URL
$foo->image(); // video placeholder image
$foo->embed(); // video iframe embed code
$foo->link(); // HTML image with link to video
$foo->responsiveEmbed(); // iframe embed with responsive wrapper

Note that responsiveEmbed needs an iframe with width and height attributes to calculate the aspect ratio of the video. Otherwise, videos are assumed to be in 16:9 format.

License

Released under the MIT License. See LICENSE for details.


All versions of monolith-core with dependencies

PHP Build Version
Package Version
No informations.
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 castlegate/monolith-core contains the following files

Loading the files please wait ....