Download the PHP package flying/css-classes without Composer

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

css-classes

Simple library to manage a list of CSS classes.

It simplifies tasks of constructing a list of CSS classes from given information, adding and removing classes from the list.

Installation

Simply install it using Composer:

Standalone usage

Functionality is exposed via ClassesInterface interface.

Further documentation uses immutable Classes implementation as an example unless explicitly defined otherwise, but MutableClasses have exactly same usage in except of mutability.

Accepted values

Any method that is mean to accept CSS classes actually accepts arbitrary number of arguments of any type (mixed ...$classes).

Given arguments are processed in this way:

Immutability

v1 provides only immutable implementation. Since v2 there are both immutable Classes and mutable MutableClasses implementations.

List creation

Classes list can be constructed using either by creating new Classes instance or by using Classes::from() static method. Both methods are accepted variable amount arguments of any type.

Example:

Fluent interface is also possible to use:

Classes list modification

These methods can be used to modify the list of CSS classes:

Classes list exporting

Classes list can be exported as a plain array using toArray() method.

Also, ClassesInterface interface extends ArrayAggregate and Stringable interfaces, so it is also possible to iterate over the list of CSS classes and cast its value into string.

Other methods

ClassesInterface extends Countable interface, so number of available CSS classes can be calculated using count() PHP function or by calling count() method.

It is also possible to check if given CSS class is available in the list by using has(string $class) method.

Standalone classes() function

For simple cases when it is only needs to create CSS classes list as a string from available data it is also possible to use \Flying\Util\Css\classes() function.

classes() function is available since v1.1.0

Usage in Twig

Library includes \Flying\Util\Css\Twig\ClassesExtension Twig extension that exposes classes function that provides same functionality as a main class.

It can be used as a simple construction of the classes list:

But it is also possible to use CSS classes list modification methods:

Refer to the Twig documentation on how to add the extension to the Twig.

For Symfony, there is a separate bundle to simplify integration.

License

Library is licensed under MIT license.


All versions of css-classes with dependencies

PHP Build Version
Package Version
Requires php Version ^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 flying/css-classes contains the following files

Loading the files please wait ....