2017 © Pedro Peláez
 

library xmlresourceretriever

XSD and XLST resource downloader for local storage

image

eclipxe/xmlresourceretriever

XSD and XLST resource downloader for local storage

  • Wednesday, January 17, 2018
  • by eclipxe
  • Repository
  • 1 Watchers
  • 1 Stars
  • 926 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 28 % Grown

The README.md

Eclipxe/XmlResourceRetriever

![Source Code][badge-source] Packagist PHP Version Support ![Latest Version][badge-release] Software License [![Build Status][badge-build]][build] Scrutinizer ![Coverage Status][badge-coverage] Total Downloads, (*1)

XSD and XLST resource downloader for local storage, (*2)

The purpose of this library is to download recursively XML resources from the internet to a local storage for further usage. At this moment it only allows Schemas (XSL) and Transformations (XSLT) but is easely extensible implementing the RetrieverInterface interface or extending the AbstractXmlRetriever class., (*3)

For every downloaded file it will override its dependences to a relative location, in this way, every dependence should be available to work offline., (*4)

You can use the local object PhpDownloader that simply uses copy function to get and store a file from internet. You can also use your own implementation of the DownloaderInterface according to your needs. If you built a configurable and useful downloader class feel free to contribute it to this project., (*5)

Installation

Use composer, so please run, (*6)

composer require eclipxe/xmlresourceretriever

Basic usage

<?php
declare(strict_types=1);
/*
 * This will download the file into
 * /project/cache/www.sat.gob.mx/sitio_internet/cfd/3/cadenaoriginal_3_3/cadenaoriginal_3_3.xslt
 * and all its includes and imports (currently 27 files)
 */
use Eclipxe\XmlResourceRetriever\XsltRetriever;
$xslt = new XsltRetriever('/project/cache');
$local = $xslt->retrieve('http://www.sat.gob.mx/sitio_internet/cfd/3/cadenaoriginal_3_3/cadenaoriginal_3_3.xslt');
echo $local; /* /project/cache/www.sat.gob.mx/sitio_internet/cfd/3/cadenaoriginal_3_3/cadenaoriginal_3_3.xslt */

Retriever more information

These methods apply to XslRetriever and XsltRetriever, (*7)

  • retrieve($url) Download recursively an url and store it into the retriever base path, it changes the child elements that contains references to other files.
  • download($url) Download an url and store it into the retriever base path. It does not validate the file for xml errors. It does not download dependences.
  • buildPath($url) Return the location of were a file should be stored according to the base path.
  • setDownloader($downloader) Change the default PhpDownloader to a custom implementation.

XsdRetriever search for namespace http://www.w3.org/2001/XMLSchema elements import and include., (*8)

XsltRetriever search for namespace http://www.w3.org/1999/XSL/Transform elements import and include., (*9)

PHP Support

This library is compatible with the latest PHP supported version and above. Please, try to use the full potential of the language., (*10)

Contributing

Contributions are welcome! Please read CONTRIBUTING for details and don't forget to take a look the TODO and CHANGELOG files., (*11)

The Eclipxe\XmlResourceRetriever library is copyright © Carlos C Soto and licensed for use under the MIT License (MIT). Please see LICENSE for more information., (*12)

The Versions

17/01 2018

dev-master

9999999-dev https://github.com/eclipxe13/XmlResourceRetriever

XSD and XLST resource downloader for local storage

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-xml *

 

The Development Requires

17/01 2018

v1.2.0

1.2.0.0 https://github.com/eclipxe13/XmlResourceRetriever

XSD and XLST resource downloader for local storage

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-xml *

 

The Development Requires

04/10 2017

v1.1.0

1.1.0.0 https://github.com/eclipxe13/XmlResourceRetriever

XSD and XLST resource downloader for local storage

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-xml *

 

The Development Requires

25/09 2017

v1.0.0

1.0.0.0 https://github.com/eclipxe13/XmlResourceRetriever

XSD and XLST resource downloader for local storage

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-xml *

 

The Development Requires