pastuhov / php-file-stream
Big file creation helper. May be used for sitemap.xml or YML files creation.
Installs: 18 920
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-12-21 19:03:11 UTC
README
A PHP class to generate sitemap files for large web-sites or YML (Yandex Market Language) files
Install
Via Composer
$ composer require pastuhov/php-file-stream
Features
- transparent file splitting (multiple sitemaps)
- fast and safe file replacement from tmp to public directory
- dependencies: 0
Usage
Simple YML export
$stream = new FileStream( '/tmp/export.yml' ); $stream->write('<yml_catalog date="2010-04-01 17:00">'); ... $stream->write('</yml_catalog>');
Advanced usage (large site sitemap, >10k urls)
$stream = new FileStream( '/tmp/sitemap{count}.xml', '<urlset>', '</urlset>', 10000 ); foreach ($urls as $url) { $stream->write( '<url><loc>' . $url . '</loc></url>' . PHP_EOL ); }
Testing
$ composer test
or
$ phpunit
Security
If you discover any security related issues, please email kirill@pastukhov.su instead of using the issue tracker.
Credits
License
GNU General Public License, version 2. Please see License File for more information.