Skip to content

Commit

Permalink
Removed PHP 5.2 support and moved code to psr-4 file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
duzun committed Jul 3, 2018
1 parent 902402f commit 3802fe5
Show file tree
Hide file tree
Showing 21 changed files with 3,371 additions and 3,356 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ php:

matrix:
include:
- php: 5.2
dist: precise
- php: 5.3
dist: precise
allow_failures:
- php: nightly
- php: hhvm
- php: 5.3
- php: 5.2

dist: trusty

Expand All @@ -38,4 +34,4 @@ deploy:
secure: UeTmKdjg0MEmy8iK0ZmlmNww+hytHQoEkh7uhssV2Pizq2sSEKki9m64v7xe35Kwk38TcbMvrZkwtim/ZnZt1JJ2LOw8Ogz88OVviqAfkHOe2VRH8SrP3NpRFGFWLZ0JmvKGkvCLiDkLHiz+vSegUXDPwyGdpS932lyxJ5U3ntE=
on:
tags: true
repo: duzun/hquery.php
repo: hquery.php
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ An extremely fast and efficient web scraper that parses megabytes of HTML in a b
- Doesn't require cURL to be installed
- Automatically handles redirects (301, 302, 303)
- Caches response for multiple processing tasks
- PHP 5+
- PHP 5.3+
- No dependencies

# Install
Expand All @@ -31,12 +31,12 @@ or using `npm install hquery.php`, `require_once 'node_modules/hquery.php/hquery

### Basic setup:
```php
// Optionally use namespaces
use duzun\hQuery;

// Either use commposer, either include this file:
include_once '/path/to/libs/hquery.php';

// Optionally use namespaces (PHP >= 5.3.0 only)
use duzun\hQuery;

// Set the cache path - must be a writable folder
// If not set, hQuery::fromURL() whould make a new request on each call
hQuery::$cache_path = "/path/to/cache";
Expand Down Expand Up @@ -76,7 +76,7 @@ $doc->base_url = 'http://desired-host.net/path';
### Load a remote HTML document
###### [hQuery::fromUrl](https://duzun.github.io/hQuery.php/docs/class-hQuery.html#_fromURL)( string `$url`, array `$headers` = NULL, array|string `$body` = NULL, array `$options` = NULL )
```php
use duzun\hQuery; // Optional (PHP 5.3+)
use duzun\hQuery;

// GET the document
$doc = hQuery::fromUrl('http://example.com/someDoc.html', ['Accept' => 'text/html,application/xhtml+xml;q=0.9,*/*;q=0.8']);
Expand Down
10 changes: 10 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
function _hQuery_autoloader($class) {
if ( strncmp($class, 'duzun\\', 6) == 0 ) {
$fn = realpath(__DIR__ . '/src/' . strtr(substr($class, 5), '\\', DIRECTORY_SEPARATOR) . '.php');
return include_once $fn;
}
return false;
}

return spl_autoload_register('_hQuery_autoloader');
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "duzun/hquery",
"type": "library",
"description": "An extremely fast web scraper that parses megabytes of HTML in a blink of an eye. No dependencies. PHP5+",
"version": "1.7.4",
"version": "2.0.0",
"license": "MIT",
"authors": [
{
Expand All @@ -27,12 +27,12 @@
"minimum-stability": "RC",
"prefer-stable": true,
"autoload": {
"psr-4": {
"duzun\\": "src/"
},
"classmap": [
"hquery.php"
],
"psr-4": {
"duzun\\": "psr-4"
}
]
},
"support": {
"email": "[email protected]",
Expand All @@ -52,7 +52,7 @@
]
},
"require": {
"php": ">=5.0.0"
"php": ">=5.3"
},
"require-dev": {
"apigen/apigen": "~4.1",
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3802fe5

Please sign in to comment.