Download .zip |
Info | Example | View files (43) | Download .zip | Reputation | Support forum (2) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-04-26 (Less than 1 hour ago) | 69% | Total: 295 This week: 1 | All time: 7,267 This week: 326 |
Version | License | PHP version | Categories | |||
csstoinlinestyles 1.6.37 | BSD License | 5.3 | HTML, PHP 5, Parsers |
WARNING: this is only a Extended-Fork of "https://github.com/tijsverkoyen/CssToInlineStyles"
> CssToInlineStyles is a class that enables you to convert HTML-pages/files into > HTML-pages/files with inline styles. This is very usefull when you're sending > emails.
PHP CssToInlineStyles is a class to convert HTML into HTML with inline styles.
The recommended installation way is through Composer.
$ composer require voku/css-to-inline-styles
use voku\CssToInlineStyles\CssToInlineStyles;
// Convert HTML + CSS to HTML with inlined CSS
$cssToInlineStyles= new CssToInlineStyles();
$cssToInlineStyles->setHTML($html);
$cssToInlineStyles->setCSS($css);
$html = $cssToInlineStyles->convert();
// Or use inline-styles blocks from the HTML as CSS
$cssToInlineStyles = new CssToInlineStyles($html);
$cssToInlineStyles->setUseInlineStylesBlock(true);
$html = $cssToInlineStyles->convert();
// Or use linked files from the HTML as CSS
$cssToInlineStyles = new CssToInlineStyles($html);
$cssToInlineStyles->setLoadCSSFromHTML(true);
$html = $cssToInlineStyles->convert(false, 0, __DIR__ . '/../tests/');
The following properties exists and have set methods available:
Property | Default | Description -------|---------|------------ cleanup|false|Should the generated HTML be cleaned? useInlineStylesBlock |false|Use inline-styles block as CSS. stripOriginalStyleTags |false|Strip original style tags. excludeMediaQueries |true|Exclude media queries from extra "css" and keep media queries for inline-styles blocks. excludeConditionalInlineStylesBlock |true|Exclude conditional inline-style blocks.
Also if the default is `
cleanup === false`
, you maybe need to use this feature, because Outlook has some special features where the inline-CSS will be ignored and it will fallback to use only the CSS-Class- or ID-properties.
$cssToInlineStyles->setCleanup(true);
Files |
File | Role | Description | ||
---|---|---|---|---|
example (2 files, 1 directory) | ||||
src (3 files) | ||||
tests (3 files, 1 directory) | ||||
.editorconfig | Data | Auxiliary data | ||
.scrutinizer.yml | Data | Auxiliary data | ||
.styleci.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE.md | Lic. | License text | ||
phpcs.php_cs | Example | Example script | ||
phpstan.neon | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | example |
File | Role | Description | ||
---|---|---|---|---|
examples (1 directory) | ||||
config.php | Aux. | Auxiliary script | ||
index.php | Example | Example script |
Files | / | src |
File | Role | Description |
---|---|---|
CssToInlineStyles.php | Class | Class source |
Exception.php | Class | Class source |
Specificity.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
fixtures (22 files) | ||||
bootstrap.php | Aux. | Auxiliary script | ||
CssToInlineStylesTest.php | Class | Class source | ||
SpecificityTest.php | Class | Class source |
Files | / | tests | / | fixtures |
File | Role | Description |
---|---|---|
style.css | Data | Auxiliary data |
style_big.css | Data | Auxiliary data |
test1Html.html | Doc. | Documentation |
test1Html_result.html | Doc. | Documentation |
test1Latin.txt | Doc. | Documentation |
test1Utf8.txt | Doc. | Documentation |
test2Css.css | Data | Auxiliary data |
test2Html.html | Doc. | Documentation |
test2Html_result.html | Doc. | Documentation |
test3Html.html | Doc. | Documentation |
test3Html_result.html | Doc. | Documentation |
test4Html.html | Doc. | Documentation |
test4Html_result.html | Doc. | Documentation |
test5Html.html | Doc. | Documentation |
test5Html_result.html | Doc. | Documentation |
test6Html.html | Doc. | Documentation |
test6Html_result.html | Doc. | Documentation |
test6Style.css | Data | Auxiliary data |
test7Html.html | Doc. | Documentation |
test7Html_result.html | Doc. | Documentation |
test_big.html | Doc. | Documentation |
test_big_result.html | Doc. | Documentation |
csstoinlinestyles-2019-04-26.zip | |
csstoinlinestyles-2019-04-26.tar.gz | |
Install with Composer |
Needed packages | ||
Class | Download | Why it is needed | Dependency |
---|---|---|---|
Simple HTML DOM | .zip .tar.gz | Dom-Manipulation | Required |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.