Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.78 KB

UPGRADE.md

File metadata and controls

57 lines (36 loc) · 1.78 KB

FROM 2.x to 3.0

It should be easy if you didn't override or extend Graby. I tried to typehint everything (method parameters, method return, variable, etc.).

So you must update methods you overridden.

⚠️ BC changes

  • Support for PHP < 7.4 has been dropped
  • Graby::fetchContent() now returns a Content object rather than an array.
  • ConfigBuilder::build() has been removed. Use either buildForHost()/buildFromUrl() for the merged config or loadSiteConfig() to get the config for a site.
  • ConfigBuilder::getCachedVersion() and ConfigBuilder::loadSiteConfig() will now return null instead of false when SiteConfig cannot be loaded.

FROM 1.x to 2.0

⚠️ BC changes

  • Support for PHP < 7.1 has been dropped
  • PHP extension tidy is now a requirement

🔌 Now decoupled from the HTTP client

Graby 1 was hardly tied to Guzzle 5.

Graby 2 supports any HTTP client implementation. It is currently tested against:

  • Guzzle 6
  • Guzzle 5
  • cURL

Here is how to install Graby with Guzzle 6:

composer require j0k3r/graby php-http/guzzle6-adapter

Then:

use Graby\Graby;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

$graby = new Graby([], new GuzzleAdapter(new GuzzleClient()));

👋 Configuration removed

  • http_client.timeout option is gone, you should now implement it using the adapter of your choice, see this part of the README.

🔀 Return information

  • all_headers became headers
  • open_graph no longer exist (title, image & locale are merged into global result)
  • content_type no longer exist (check headers key instead)