Skip to content

Repository files navigation

Inteve\Utils

Build StatusDownloads this MonthLatest Stable VersionLicense

Utility classes for web development

Donate

Installation

Download a latest package or use Composer:

composer require inteve/utils

Inteve\Utils requires PHP 8.0 or later.

Usage

DateTimeFactory

$dateTimeFactory = newInteve\Utils\DateTimeFactory;
$now = $dateTimeFactory->create();

Imagick

useInteve\Utils\ImagickHelper;
$imagick = ImagickHelper::openImage('file.jpg');
ImagickHelper::resize($imagick, $width, $height, $flags); // same parameters as for Image::resize()
ImagickHelper::saveImage($imagick, 'thumb.jpg');
// and much more!

PaginatorHelper

$paginator = newNette\Utils\Paginator;
$steps = Inteve\Utils\PaginatorHelper::calculateSteps($paginator);

XmlDocument

$xml = newInteve\Utils\XmlDocument([
'standalone' => 'yes',
]);
$root = $xml->create('urlset');
$item = $root->create('url');
$item->create('loc')->setText('http://example.com/');
echo$xml->toString();

Prints:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<urlset>
<url>
<loc>http://example.com/</loc>
</url>
</urlset>

XmlQuery

Wrapper of SimpleXml.

$query = Inteve\Utils\XmlQuery::fromString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><urlset>	<url> <loc>http://example.com/</loc>	</url>	<url> <loc>http://example.com/path</loc>	</url></urlset>');
$urls = [];
foreach ($query->children('url') as$url) {
$urls[] = $url->child('loc')->text();
}
var_dump($urls);

Prints:

http://example.com/
http://example.com/path

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/

About

Utility classes for web development

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages