Download the PHP package layered/page-meta without Composer

On this page you can find all versions of the php package layered/page-meta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package page-meta

Page Meta 🕵

Page Meta is a PHP library than can retrieve detailed info on any URL from the internet! It uses data from HTML meta tags and OpenGraph with fallback to detailed HTML scraping.

Highlights

Potential use cases

How to use

Installation

Add layered/page-meta as a dependency in your project's composer.json file:

Usage

Create a UrlPreview instance, then call loadUrl($url) method with your URL as first argument. Preview data is retrieved with get($section) or getAll() methods:

Behind the scenes

The library downloads the HTML source of the url you provided, then uses specialized scrapers to extract pieces of information. Core scrapers can be seen in src/scrapers/, and they extract general info for a page: title, author, description, page type, main image, etc. If you would like to extract a new field, see Extending the library section.

User Agent or extra headers can make a big difference when downloading HTML from a website. There are some websites that forbid scraping and hide the content when they detect a tool like this one. Make sure to read their dev docs & TOS.

The default User Agent is blocked on sites like Twitter, Instagram, Facebook and others. A workaround is to use this one (thanks for the tip PVGrad):

'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'

Returned data

Returned data will be an Array with following format:

See UrlPreview::getAll() for info on each returned field.

Public API

UrlPreview class provides the following public methods:

__construct(array $headers): UrlPreview

Start the UrlPreview instance. Pass extra headers to send when requesting the page URL

loadUrl(string $url): UrlPreview

Load and start the scrape process for any valid URL

getAll(): array

Get all data scraped from page

Return: Array with scraped data in following format:

get(string $section): array

Get data in one scraped section site, page, profile or app_links

Return: Array with section scraped data. See UrlPreview::getAll() for data format

addListener(string $eventName, callable $listener, int $priority = 0): UrlPreview

Attach an event on UrlPreview for data processing or scrape process. Arguments:

Extending the library

If there's need to more scraped data for a URL, more functionality can be attached to PageMeta library. Example for returing the 'Terms and Conditions' link from pages:

More

Please report any issues here on GitHub.

Any contributions are welcome


All versions of page-meta with dependencies

PHP Build Version
Package Version
Requires fabpot/goutte Version ~4.0
symfony/event-dispatcher Version ~5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package layered/page-meta contains the following files

Loading the files please wait ....