PHPackages                             xanweb/c5-page-info - 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. xanweb/c5-page-info

ActiveLibrary

xanweb/c5-page-info
===================

Concrete5 Page Info

v1.2.1(4y ago)0213MITPHPPHP &gt;=7.2

Since Feb 1Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Xanweb/c5-page-info)[ Packagist](https://packagist.org/packages/xanweb/c5-page-info)[ RSS](/packages/xanweb-c5-page-info/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Concrete5 Page Info Fetcher
===========================

[](#concrete5-page-info-fetcher)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a6d948bf333340be53907052da799acced17186b0d2157d44f3f24589086080/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78616e7765622f63352d706167652d696e666f2e7376673f6d61784167653d32353932303030267374796c653d666c61742d737175617265)](https://packagist.org/packages/xanweb/c5-page-info)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Useful in page lists when using different templates, it helps to avoid redundant code.

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

[](#installation)

Include library to your composer.json

```
composer require xanweb/c5-page-info
```

Simple usage example
--------------------

[](#simple-usage-example)

```
$pageInfoFactory = new Xanweb\PageInfo\Factory(); // We can pass our own config (Check `Config Management` section), otherwise default config will be used.
foreach ($pages as $page) {
    $pageInfo = $pageInfoFactory->build($page);
    $pageName = $pageInfo->fetchPageName($truncateChars, $tail); // Page name with htmlentites applied
                                                                //  $truncateChars: an optional argument can be passed to truncate description
    $pageDescription = $pageInfo->fetchPageDescription($truncateChars, $tail); // $truncateChars: an optional argument can be passed to truncate description
    $thumbnail = $pageInfo->fetchThumbnail($defaultThumbnail); // By default uses 'thumbnail' attribute.
    $formattedPublishDate = $pageInfo->getPublishDate($format); // Optionally you can pass format argument ('full', 'long', 'medium' or 'short') or a php custom format
    $formattedPublishDateTime = $pageInfo->getPublishDateTime();
    $authorUserInfo = $pageInfo->getAuthor();
    $lastEditedByUserInfo = $pageInfo->getLastEditor();
    $lastEditedByUserName = $pageInfo->getLastEditorUserName();
    $tags = $pageInfo->getTags();

    $linkTag = \HtmlObject\Link::create($pageInfo->getURL(), $pageName, ['target' => $pageInfo->getTarget()]);
}
```

Config Management
-----------------

[](#config-management)

You can register your own config to fetch page information

```
use Xanweb\PageInfo\Fetcher\AttributePropertyFetcher;
use Xanweb\PageInfo\Fetcher\BlockPropertyFetcher;
use Xanweb\PageInfo\Fetcher\PagePropertyFetcher;

// Order of registering fetchers is important.
// The first registered will be firstly fetched.
$config = $app->make(Xanweb\PageInfo\Config::class);

// if display_name attribute is filled for the page then it will be used otherwise the page name will be used
$config->registerPageNameFetcher(new AttributePropertyFetcher('display_name'));
$config->registerPageNameFetcher(new PagePropertyFetcher(PagePropertyFetcher::PAGE_NAME));
$config->registerPageDescriptionFetcher(new PagePropertyFetcher(PagePropertyFetcher::PAGE_DESCRIPTION));

// Fetch thumbnail from a custom attribute
$config->registerThumbnailFetcher(new AttributePropertyFetcher('my_thumbnail_ak'));
// Fetch thumbnail from a block within the page. (requires installing "xanweb/c5-helpers" library)
$config->registerThumbnailFetcher(new BlockPropertyFetcher(
    'image', // Block Type handle
    function ($bController) { // Method will be called to return thumbnail file if the block is found.
        return $bController->getFileObject();
    },
    // In case we have more than a block in the page, we may need to refine the fetching by making some checks
    // for the found block
    function ($bController) {
        return $bController->getFileObject() !== null;
    },
    // More refining also can be done by excluding some areas from fetching, example:
    ['Right Sidebar', 'Left Sidebar', 'Footer']
    )
);

$cfgManager = Xanweb\PageInfo\ConfigManager::get();

$cfgManager->register('my_cfg_key', $config);
// You can also register a callable, the config then will be created only it's called
$cfgManager->register('my_cfg_key', function () {
    $config = $app->make(Xanweb\PageInfo\Config::class);
    $config->register...

    return $config;
});

$myConfig = $cfgManager->getConfig('my_cfg_key');
```

Predefined Configs
------------------

[](#predefined-configs)

1. *DEFAULT:*

    - **Page Name:** \[Page Name Property\]
    - **Page Description:** \[Page Description Property\]
    - **Thumbnail:** \['thumbnail' attribute\]
2. *BASIC:*

    - **Page Name:** \[Page Name Property\]
    - **Page Description:** \[Page Description Property\]
    - **Thumbnail:** \['thumbnail' attribute, Image Block\]
3. *ADVANCED:*

    - **Page Name:** \[Page Title Block, Page Name Property\]
    - **Page Description:** \[Page Description Property\]
    - **Thumbnail:** \['thumbnail' attribute, Image Block\]
        *If 'page\_heading' block (Custom block by Xanweb) is installed, then it will be:*
    - **Page Name:** \[Page Heading Block, Page Name Property\]
    - **Page Description:** \[Page Heading Block, Page Description Property\]
    - **Thumbnail:** \['thumbnail' attribute, Image Block\]

Example of using predefined config:

```
$myConfig = Xanweb\PageInfo\ConfigManager::getBasic();
$pageInfoFactory = new Xanweb\PageInfo\Factory($myConfig);
```

OR

```
$pageInfoFactoryWithDefaultConfig = new Xanweb\PageInfo\Factory();
$pageInfoFactoryWithBasicConfig = $pageInfoFactoryWithDefaultConfig->withConfig('basic');
```

How to override PageInfo class
------------------------------

[](#how-to-override-pageinfo-class)

```
class MyPageInfo extends \Xanweb\PageInfo\PageInfo {

}
$pageInfoFactory = new Xanweb\PageInfo\Factory($myConfig, MyPageInfo::class);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

Every ~42 days

Total

4

Last Release

1798d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13836863?v=4)[Hamed Darragi](/maintainers/HamedDarragi)[@HamedDarragi](https://github.com/HamedDarragi)

---

Top Contributors

[![HamedDarragi](https://avatars.githubusercontent.com/u/13836863?v=4)](https://github.com/HamedDarragi "HamedDarragi (26 commits)")

---

Tags

helpersconcrete5concrete5-v8

### Embed Badge

![Health badge](/badges/xanweb-c5-page-info/health.svg)

```
[![Health](https://phpackages.com/badges/xanweb-c5-page-info/health.svg)](https://phpackages.com/packages/xanweb-c5-page-info)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[laravel/helpers

Provides backwards compatibility for helpers in the latest Laravel release.

80660.2M457](/packages/laravel-helpers)

PHPackages © 2026

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