Download the PHP package bradietilley/laravel-css-inliner without Composer

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

CSS Style Inliner for Laravel

Static Analysis Tests

Overview

This package leverages tijsverkoyen/css-to-inline-styles to convert CSS classes in mailable views to inline styles, for improved email client compatibility.

You can either leverage the automation of this package, or opt to hook into this package's event (or even Laravel's core events) and manually choose what gets converted and with what stylesheets. See Usage section for more details.

Install

Via Composer

Usage

For the purpose of this demonstration we'll use the facade BradieTilley\LaravelCssInliner\Facades\CssInline, however if you prefer directly using the instance (like myself) you can swap out BradieTilley\LaravelCssInliner\Facades\CssInline:: for any of the below:

Adding CSS via PHP

You can at any point (before HTML conversion) define your CSS files or raw CSS that you wish to add to every HTML string or email that is converted by the CSS Inliner. A good example of this is a base stylesheet that all emails should inherit.

Manual conversion

You may wish to manually convert some CSS in an HTML string or Email.

Option: Automatically parse Laravel email (or don't automatically parse Laravel email)

You may wish to conditionally enable or disable the CSS Inliner for mail sent from Laravel (via Mail::send()). To do this, we can leverage the emailListener option. Default is true (and as such will automatically convert CSS classes found in your emails sent from Laravel).

Option: Read CSS (style and link elements) from within any of the given HTML or emails

You may wish to parse <style> or <link> stylesheets that are found within the HTML or email, for example if you want to store email-specific CSS within the email view itself. To do this, we can leverage the cssFromHtmlContent option. Default is false.

Option: After reading CSS (from above), remove the original CSS (style and link elements) from the HTML or email

You may wish to strip out the large <style> or <link> stylesheets after this package converts the CSS to inline styles, to reduce the payload size of emails sent out from your system. To do this, we can leverage the cssRemovalFromHtmlContent option. Default is false.

Events:

There are four events fired by CssInliner - two for HTML conversion, and all four for Email conversion. The order of which the events are called is:

Listening to events can be done through Laravel's normal means. For example:

Or, you may wish to hook into CSS Inliner using the callback methods: beforeConvertingEmail, afterConvertingEmail, beforeConvertingHtml, afterConvertingHtml. These methods accept a callback and are simply a proxy to Event::listen() so feel free to treat the callbacks used in the examples below as the second argument to Event::listen() of the corresponding CssInliner events.

Event: Before Email is Converted (beforeConvertingEmail)

Event: Before HTML is Converted (beforeConvertingHtml)

Event: After HTML is Converted (afterConvertingHtml)

Event: After Email is Converted (afterConvertingEmail)

Change log

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

Testing

Contributing

Please see CONTRIBUTING for details.


All versions of laravel-css-inliner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0
illuminate/support Version ^10.0
symfony/mime Version ^6.1
tijsverkoyen/css-to-inline-styles Version ^2.2
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 bradietilley/laravel-css-inliner contains the following files

Loading the files please wait ....