Download the PHP package vewe/classvariance without Composer

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

Vewe ClassVariance

About

Aiming to be an all-PHP combined implementation of Class Variance Authority, twMerge, and Tailwind-Variants.

Supporting the current version of PHP, less one, as a minimum requirement, to keep the package freshly maintained and utilising the latest features of PHP.

Version Strategy

Based on semantic versioning, with the following constraints

Major point releases may introduce breaking changes, which will be in the release notes.

Minor point releases should be non-breaking changes and fixes.

Installation

You can install the package via composer:

Usage

Cv, with slots, akin to Tailwind-Variants

You can declare your classes as a single string, space delimited, or you can provided it as an array of strings, or a mix of the two methods, as suits your needs.

When using slots, always declare a 'base' slot consistently in the Cv::new definition. Unlike Tailwind-Variants, Cv does not assume which classes are meant for which slot, you must be declarative.

This is a conscious design decision, as your definition should have an immutable source of truth, instead of relying on script defaults which could change over time.

When you don't specify a slot, it defaults to returning the 'base' slot

You can use named properties or you can pass an empty array for $props.

You can also take advantage of Tailwind-Variants style declarations, for your component to have multiple sub-components.

[!TIP] Looking for a comprehensive set of components using Cv? Take a look at vewe/ui! Ready for use with TempestPHP or adapt to anything you like.

Cv, without slots

When not using slots, simply omit them from your definitions entirely.

Equally, do not pass the slot property at all.

Merging additional class data

Whether or not you implement slots configuration, if you wish to pass additional classes to be merged one-off into a specific button, you can pass it in either class or className within $props.

Testing

Credits and Acknowledgements

A special thank you to the following, without whom this package would not exist.

Also a thank you to the following projects, whose own ideas helped shape Cv.

License

The MIT License (MIT). Please see License File for more information.


All versions of classvariance with dependencies

PHP Build Version
Package Version
Requires php Version 8.4.* || 8.5.*
tales-from-a-dev/tailwind-merge-php Version ^0.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 vewe/classvariance contains the following files

Loading the files please wait ...