2.5.0releasedRemote Datasource
A datasource that consumes XML, JSON, CSV or TEXT content.
Clone URLhttps://github.com/symphonycms/remote_datasource.git
Add as a submodulegit submodule add https://github.com/symphonycms/remote_datasource.git extensions/remote_datasource --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No | No | No | 1.1.0 | 2.3.1 | 2.3.1 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 | 2.5.0 |
Readme
Remote Datasource
The Remote Datasource allows you to consume XML, JSON, CSV and TXT sources in Symphony. This extension aims to build upon the Dynamic XML datasource functionality provided in Symphony to allow better cache control, the automatic discovery of namespaces and more flexibility.
Installation
Install this extension by copying
/remote_datasource
folder to your/extensions
folder. Then navigate to the System > Extensions page in the Symphony backend page, select the Remote Datasource extension and then apply the "Enable/Install".Create a new Remote Datasource via the Datasource Editor, choosing Remote Datasource from the Source dropdown (it's under __From extensions)
API
If you need to add custom php code in your Data Source, there is two methods that you can override in your DataSource sub-class:
````php
/**
* This methods allows custom remote data source to set other
* properties on the HTTP gateway, like Authentication or other
* parameters. This method is call just before the exec
method.
*
* @param Gateway $gateway
* the Gateway object that will be use for the current HTTP request
* passed by reference
*/
public static function prepareGateway(&$gateway) {}
/** * This methods allows custom remote data source to read the returned * data before it becomes only available in the XML. * * @since Remote Datasource 2.0 * @param string $data * the parsed xml string data returned by the Gateway by reference */ public function exposeData(&$data) {}
/** * This method is called when their is an http error * or when content type is unsupported * * @since Remote Datasource 2.0 * @param array $info * info of the http request */ public function httpError(&$info) {} ````
Version history
Symphony 2.6 to 3.x.x
- Handle 404 properly when the Exception in thrown from execute
Symphony 2.6 to 3.x.x
- Pass namespace to the cacheable instance
Symphony 2.4 to 3.x.x
- [#37](https://github.com/symphonycms/remote_datasource/issues/37) Fix error when multiple datasources are added to the same page with different formats.
Symphony 2.4 to 3.x.x
- Bug fixes
- Added compatibility with Symphony 2.7.x and 3.x.x
Symphony 2.4 to 2.6.x
- Fix for php 5.3 compat
Symphony 2.4 to 2.6.x
- Make CSV style configurable.
- Fix `{$workspace}` path
Symphony 2.4 to 2.6.x
- Fix a bug with late static binding on PHP 5.3.
Symphony 2.4 to 2.6.x
- Fix the first cache of a result always resulting in an error
- Abstract the transformers for better extensibility
Requires Symphony 2.4
- Expose the CURL error via `httpError()`
- Fix error with CSV importing
Requires Symphony 2.4
- Add support for text format (a copy of the html response body)
- Add some documentation
Requires Symphony 2.4
- Clean-up
Requires Symphony 2.4
- Add support for Symphony 2.4
- Support CSV data format
- Allow `$gateway` to be manipulated and `$data` to previewed
- When the Datasource fails, data is added to the `?debug` page to assist in debugging
- Allow no cache to be set
- Sanitize XPath to allow for more complex queries
Symphony 2.3 to 2.4
- Officially release the extension
- Add `url` to the resulting XML result so you can see what URL was actually fetched
- Fix bug where a result would always be `stale`
- Allow timeout to be user configurable in the Data Source Editor
- Various PHP E_NOTICE fixes
Requires Symphony 2.3
- Initial release