PHPackages                             ones006/link-preview - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ones006/link-preview

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ones006/link-preview
====================

Link preview library for PHP

v1.0(5y ago)05MITPHPPHP &gt;=5.6

Since Aug 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ones006/link-preview)[ Packagist](https://packagist.org/packages/ones006/link-preview)[ Docs](http://github.com/ones006/link-preview)[ RSS](/packages/ones006-link-preview/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

LinkPreview
===========

[](#linkpreview)

A PHP library to easily get website information (title, description, image...) from given url.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 5.6 (without phpunit it should work on 5.5)
- Guzzle

Installation
------------

[](#installation)

### composer

[](#composer)

To install LinkPreview with composer you need to create `composer.json` in your project root and add:

```
{
    "require": {
        "ones006/link-preview": "dev-master"
    }
}
```

Then run

```
$ wget -nc http://getcomposer.org/composer.phar
$ php composer.phar install
```

Library will be installed in vendor/ones006/link-preview

In your project include composer autoload file from vendor/autoload.php

Usage
-----

[](#usage)

```
use LinkPreview\LinkPreview;

$linkPreview = new LinkPreview('http://github.com');
$parsed = $linkPreview->getParsed();
foreach ($parsed as $parserName => $link) {
    echo $parserName . PHP_EOL . PHP_EOL;

    echo $link->getUrl() . PHP_EOL;
    echo $link->getRealUrl() . PHP_EOL;
    echo $link->getTitle() . PHP_EOL;
    echo $link->getDescription() . PHP_EOL;
    echo $link->getImage() . PHP_EOL;
    print_r($link->getPictures());
}
```

**Output**

```
general

http://github.com
https://github.com/
GitHub · Build software better, together.
GitHub is the best place to build software together. Over 10.1 million people use GitHub to share code.
https://assets-cdn.github.com/images/modules/open_graph/github-octocat.png
Array
(
    [0] => https://assets-cdn.github.com/images/modules/site/home-ill-build.png?sn
    [1] => https://assets-cdn.github.com/images/modules/site/home-ill-work.png?sn
    [2] => https://assets-cdn.github.com/images/modules/site/home-ill-projects.png?sn
    [3] => https://assets-cdn.github.com/images/modules/site/home-ill-platform.png?sn
    [4] => https://assets-cdn.github.com/images/modules/site/org_example_nasa.png?sn
)

```

\###Youtube example

```
use LinkPreview\LinkPreview;
use LinkPreview\Model\VideoLink;

$linkPreview = new LinkPreview('https://www.youtube.com/watch?v=8ZcmTl_1ER8');
$parsed = $linkPreview->getParsed();
foreach ($parsed as $parserName => $link) {
    echo $parserName . PHP_EOL . PHP_EOL;

    echo $link->getUrl() . PHP_EOL;
    echo $link->getRealUrl() . PHP_EOL;
    echo $link->getTitle() . PHP_EOL;
    echo $link->getDescription() . PHP_EOL;
    echo $link->getImage() . PHP_EOL;
    if ($link instanceof VideoLink) {
        echo $link->getVideoId() . PHP_EOL;
        echo $link->getEmbedCode() . PHP_EOL;
    }
}
```

**Output**

```
youtube

https://www.youtube.com/watch?v=8ZcmTl_1ER8
http://gdata.youtube.com/feeds/api/videos/8ZcmTl_1ER8?v=2&alt=jsonc
Epic sax guy 10 hours
I had to remove my original one so I reuploaded this with much better quality.
(If you want it sound like previous one, try setting quality to 240p)
Yeah, I know that video sucks compared to original but no can do :(
http://i1.ytimg.com/vi/8ZcmTl_1ER8/hqdefault.jpg
8ZcmTl_1ER8

```

Todo
----

[](#todo)

1. Add more unit tests
2. Update documentation
3. Add more parsers

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2013 Tadas Juozapaitis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fcd56fd5d0fe37210c86db2c41987873118fdae41a42e4e97e3f90ba7f2497a?d=identicon)[OnesLynx](/maintainers/OnesLynx)

---

Top Contributors

[![ones006](https://avatars.githubusercontent.com/u/262847?v=4)](https://github.com/ones006 "ones006 (1 commits)")

---

Tags

urlphpscraping

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ones006-link-preview/health.svg)

```
[![Health](https://phpackages.com/badges/ones006-link-preview/health.svg)](https://phpackages.com/packages/ones006-link-preview)
```

###  Alternatives

[dusterio/link-preview

Link preview generation for PHP with Laravel support

126326.6k3](/packages/dusterio-link-preview)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
