Download the PHP package capevace/tailpipe without Composer

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

Tailpipe

Tailwind CSS variables in PHP


Run tests Code coverage - 100% Latest release
Made by Lukas Mateffy


Features


Tailpipe is a PHP package that enables you to access Tailwind CSS variables in your PHP code. It is an extension for Tailwind CSS that generates a .php file containing the variables, which can then be used in your PHP application. This allows you to keep your styling consistent across both your CSS and PHP code, making your application more maintainable and organized.

It also provides tight integration with Laravel, allowing you to access the variables using a global helper function, a facade, or a Blade directive.





Installation

To install the Tailpipe package, you will need to install both the Laravel package capevace/tailpipe and the Tailwind CSS plugin JS package @capevace/tailpipe.


PHP Package Installation

  1. Install the package using Composer:

  2. The package will automatically register its service provider and facade in your Laravel application, if you're using it.


Tailwind CSS Plugin Installation

  1. Install the package using npm or yarn:

  2. Add the plugin to your tailwind.config.js file:

This will configure the plugin to generate a tailpipe.php file in your resources/css directory, containing the theme variables.


Usage

Tailpipe exposes a tailpipe() helper function, which you can use to access the variables in your PHP code. It also provides tight integration with Laravel, allowing you to access the variables using a facade or a Blade directive.

Helper function

You can use the tailpipe() helper function like this:

Facade

Using a Facade:

Blade directive

You can also use the @tailpipe Blade directive:

Using the Tailpipe class

If you want to use the Tailpipe class directly, you can do so like this:

When using the Tailpipe class directly, you can pass along the filepath to your tailpipe.php file. This will be used in that specific instance, allowing you to use multiple tailpipe.php files per project.


Options

The tailpipe() helper function accepts the following options:

parse: bool

If parse is set to true, the value will be parsed and returned as a string without units. This is useful if you want to use the value in a script or to calculate with it, for example.

The following values will be parsed:

Type Example Input (string) Example Output
hex codes "#fbbf24" "fbbf24": string
integers "768px" 768: int
floats "0.5" 0.5: float
percentages "50%" 0.5: float

Numbers will be parsed from the following units: px, rem, em, vh, vw, vmin, vmax, ms, s, %, deg, rad, turn.


Required setup for non-Laravel projects

By default, the plugin will generate a tailpipe.php file in your resources/css directory. The path is determined using Laravel's resource_path function.

If you're not using Laravel, you can have to set the outputPath option to a custom path:

You will also need to set the TAILPIPE_PATH environment variable to the path of the tailpipe.php file.

In the .env file:

Or in your PHP code:


Enabling more variables

By default, only the following variables are processed:


Real World Example

Here's a real world example of how you can use Tailpipe in your Laravel application. This example uses the Alpine x-data directive to initialize a component based on the current breakpoint and loads a placeholder image with the correct theme colors.

The placeholder resolves to the following image:

resulting image


Changelog

Please see CHANGELOG for more information on what has changed recently.


All versions of tailpipe 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 capevace/tailpipe contains the following files

Loading the files please wait ....