Download the PHP package franzip/serp-page-serializer without Composer
On this page you can find all versions of the php package franzip/serp-page-serializer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download franzip/serp-page-serializer
More information about franzip/serp-page-serializer
Files in franzip/serp-page-serializer
Package serp-page-serializer
Short Description Serialize/deserialize Search Engine Result Pages to JSON and XML (JMS/Serializer wrapper).
License MIT
Homepage http://github.com/franzip/serp-page-serializer
Informations about the package serp-page-serializer
SerpPageSerializer
Serialize/deserialize Search Engine Result Pages to JSON and XML (JMS/Serializer wrapper).
Installing via Composer (recommended)
Install composer in your project:
Create a composer.json file in your project root:
Install via composer
Constructor
Data type constraints
Serialization
The method accepts only a object and returns a object. The serialized content is available through the method. Before using the serializer, normalize your data as follows:
Where:
$engine
- string- Represents the Search Engine vendor (i.e. Google, Bing, etc).
$keyword
- string- Represents the keyword associated to the Search Engine page
$pageUrl
- string- Represents the url of the Search Engine for the given keyword/pageNumber
$pageNumber
- integer- Represents the page number for the given Search Engine keyword search
$age
- DateTime object- Represents when the data were extracted
$entries
- array- Represents the core data (see below)
Every Search Engine result page entry has a tripartite structure:
- A title, usually highlighted in blue.
- A url.
- A textual snippet.
The $entries array structure must resemble the above mentioned schema, where the sequential array index stands for the entry position in the page:
Deserialization
The only accepts a as argument, yielding back a or a object.
Usage (serialize data)
Usage (deserialize data)
TODOs
- [x] Add a default $cacheDir to constructor.
- [x] A decent exceptions system.
- [x] Allow typechecking on deserialization by wrapping serialized strings in a dedicated class.
- [x] Fix serialization tests.
- [x] Fix deserialization tests.
- [x] Rewrite docs.
- [ ] CSV serialization/deserialization support.
- [ ] Fix messy tests.
License
MIT Public License.