Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inteve/utils
Utility classes for web development
https://github.com/inteve/utils
nette php utilities web-development
Last synced: about 1 month ago
JSON representation
Utility classes for web development
- Host: GitHub
- URL: https://github.com/inteve/utils
- Owner: inteve
- License: other
- Created: 2020-03-27T06:57:51.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-27T06:48:47.000Z (over 1 year ago)
- Last Synced: 2024-11-18T09:43:05.355Z (about 2 months ago)
- Topics: nette, php, utilities, web-development
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Inteve\Utils
[![Build Status](https://github.com/inteve/utils/workflows/Build/badge.svg)](https://github.com/inteve/utils/actions)
[![Downloads this Month](https://img.shields.io/packagist/dm/inteve/utils.svg)](https://packagist.org/packages/inteve/utils)
[![Latest Stable Version](https://poser.pugx.org/inteve/utils/v/stable)](https://github.com/inteve/utils/releases)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/inteve/utils/blob/master/license.md)Utility classes for web development
## Installation
[Download a latest package](https://github.com/inteve/utils/releases) or use [Composer](http://getcomposer.org/):
```
composer require inteve/utils
```Inteve\Utils requires PHP 5.6.0 or later.
## Usage
**DateTimeFactory**
```php
$dateTimeFactory = new Inteve\Utils\DateTimeFactory;
$now = $dateTimeFactory->create();
```**Imagick**
``` php
use Inteve\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**
```php
$paginator = new Nette\Utils\Paginator;
$steps = Inteve\Utils\PaginatorHelper::calculateSteps($paginator);
```**XmlDocument**
```php
$xml = new Inteve\Utils\XmlDocument([
'standalone' => 'yes',
]);
$root = $xml->create('urlset');$item = $root->create('url');
$item->create('loc')->setText('http://example.com/');echo $xml->toString();
```Prints:
```xml
http://example.com/
```
**XmlQuery**
Wrapper of SimpleXml.
```php
$query = Inteve\Utils\XmlQuery::fromString('
http://example.com/
http://example.com/path
');$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](license.md)
Author: Jan Pecha, https://www.janpecha.cz/