PHPackages                             ridenzy/lbh - 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. ridenzy/lbh

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

ridenzy/lbh
===========

Lightweight blog helpers: SEO, content, and web utilities for PHP.

v1.0.2(6mo ago)02MITPHPPHP ^8.1

Since Nov 3Pushed 6mo agoCompare

[ Source](https://github.com/ridenzy/lbh)[ Packagist](https://packagist.org/packages/ridenzy/lbh)[ Docs](https://github.com/ridenzy/lbh)[ GitHub Sponsors](https://github.com/sponsors/ridenzy)[ RSS](/packages/ridenzy-lbh/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

LBH — Lightweight Blog Helpers for PHP
======================================

[](#lbh--lightweight-blog-helpers-for-php)

> **loadBlogHelpers (LBH)** is a modular collection of PHP utilities designed to simplify blog and content-driven development.
> It provides clean helpers for SEO, Slugging, Text Extraction, HTML parsing, and network utilities — ready to drop into any PHP project.

🚀 Real-World Use Case
---------------------

[](#-real-world-use-case)

Imagine you’re running any PHP-based blog — whether it’s a small CMS you built yourself, a Next.js + PHP hybrid backend, or something like WordPress stripped down.

You’ll repeatedly need things like:

- Cutting long paragraphs into **short excerpts** for previews.
- Showing **estimated reading time** on articles.
- Generating **SEO meta tags** and **OpenGraph** data for social sharing.
- Making clean, readable **URLs and slugs**.
- Paginating article lists.
- Building a **Table of Contents** from article headings.
- Generating **RSS feeds** or **Sitemap XML**.

Rather than coding those from scratch every time, you build this once → then just `composer require ridenzy/lbh` in any future project.

It becomes your **personal developer toolkit** for all content-based sites.

---

🚀 Features
----------

[](#-features)

- **SEO Helpers** → Easily generate meta tags, sitemaps, canonical URLs, and analyze page text.
- **Content Helpers** → Slugify titles, extract keywords, parse HTML, and format text.
- **Page Helpers** → Make lightweight HTTP requests, strip markup, and extract visible DOM text.
- **PSR-4 Autoloading** → Installable and extendable as a modern Composer package.
- **Framework-Agnostic** → Works in plain PHP, Laravel, Symfony, WordPress, or custom stacks.

---

📦 Installation
--------------

[](#-installation)

From [Packagist](https://packagist.org/packages/ridenzy/lbh):

```
composer require ridenzy/lbh:^1.0
```

---

\***Or directly from GitHub:**

```
composer config repositories.lbh '{"type":"vcs","url":"https://github.com/ridenzy/lbh"}'
composer require ridenzy/lbh:dev-main
```

---

Possible to add features, More to come:

\--&gt; 🔍 **2. SEO, Metadata &amp; Social Sharing**

| `keywords_from_content(text)` | Auto-generates keyword list by frequency analysis. | SEO auto-tagging or content suggestions. | ✅ | ----------------------------- | ----------------------------------------------------- | ----------------------------------------- |

\--&gt; 📚 **3. Post Management &amp; Relationships**

`filter_by_tag(posts, tag)`Filters posts array by a specific tag.Tag-based archive pages.`group_by_month(posts)`Groups posts by publish month/year.Archives section.\--&gt; 🗺️ **4. Feeds, Discovery &amp; Automation**

`ping_search_engines(sitemap_url)`Sends sitemap update to Google/Bing.Triggered on new post publish.`feed_to_json(rss_url)`Parses RSS XML into JSON.Feed readers, integrations.`notify_subscribers(post)`Sends email or webhook notification for new post.Newsletter, push notifications.`schedule_publish(post_id, datetime)`Delays publication until a given time.Scheduled posts.\--&gt; 🖼️ **5. Image &amp; Media Handling**

`generate_thumbnail(image_path, width, height)`Creates smaller preview images.Blog home/featured posts.`lazy_load_image_tag(src, alt)`Returns `` tag.Improves performance.`optimize_image(image_path)`Compresses images before upload.Faster page loading.`embed_video(url)`Converts YouTube/Vimeo link into responsive embed code.Inline media embedding.\--&gt; 🔐 **6. Authentication &amp; Admin Helpers**

`login(email, password)`Authenticates a user.Blog admin dashboard.`logout()`Clears session.User account management.`check_auth()`Ensures a session is valid.Protecting admin pages.`hash_password(password)`Uses `password_hash()` for secure storage.Registration and login.`verify_password(password, hash)`Validates a given password.Login check.\--&gt; 🧰 **7. Database &amp; Storage**

`connect_db(config)`Creates PDO/MySQL connection.Core data access layer.`fetch_posts(limit, offset)`Retrieves posts from DB.Blog index or API.`save_post(data)`Inserts or updates post data.Admin editor save action.`delete_post(id)`Deletes post safely.Admin deletion.`backup_database()`Creates SQL backup of posts and metadata.Site maintenance.\--&gt; 📤 **8. API &amp; Integration Functions**

`api_get(endpoint, params)`Performs GET request to remote API.Pulls comments, stats, or external data.`api_post(endpoint, data)`Posts to remote API (e.g., webhook).Newsletter automation.`webhook_receive(payload)`Handles inbound webhook.Auto-publishing, integrations.`json_response(data, status=200)`Outputs clean JSON for frontend.REST API endpoints.`markdown_to_html(markdown)`Converts markdown to HTML.Editor or import/export feature.\--&gt; 📈 **9. Analytics, Stats &amp; Optimization**

`count_views(post_id)`Increments a post’s view count.Popular posts widget.`most_viewed(posts, limit)`Returns top posts by views.Sidebar popularity list.`record_referrer()`Logs where a visitor came from.Analytics and insights.`ab_test_render(variants)`Randomly selects between A/B content.Experimentation.`cache_page(key, html, ttl)`Saves rendered HTML to cache.Performance optimization.\--&gt; 🧩 **10. Frontend Presentation Helpers**

`render_post_card(post)`Returns an HTML snippet for a post preview.Home and category pages.`breadcrumb(path_array)`Builds breadcrumb navigation.SEO + UX improvement.`format_date(date, locale)`Displays date in friendly format.“Published on Oct 26, 2025”.`highlight_search(query, text)`Highlights search term in preview.On search results page.`truncate_html(html, limit)`Safely shortens HTML while keeping tags balanced.Preview snippets.🧭 **11. Developer &amp; Maintenance Functions**
-----------------------------------------------

[](#-11-developer--maintenance-functions)

`clear_cache()`Clears cached HTML/pages.Admin maintenance button.`rebuild_index()`Regenerates search index or sitemap.After mass updates.`export_json(posts)`Exports all posts to JSON.Backup or static site generator.`import_json(file)`Imports posts from JSON file.Migration from another CMS.`env(key, default)`Reads environment variables.Config management.🧱 **12. Special Use-Case Helpers**
----------------------------------

[](#-12-special-use-case-helpers)

`generate_excerpt_image_overlay(title, cover)`Creates a text overlay image (title on cover).Social share image automation.`create_post_slug_from_id(id, title)`Makes unique slugs combining ID + title.Avoids duplicate URLs.`auto_save_draft(content)`Autosaves during editing.Editor session recovery.`generate_share_links(url, title)`Builds share URLs for Twitter, LinkedIn, etc.“Share this post” buttons.`shortcode_parser(content)`Replaces `[gallery]` or `[video]` with HTML.Extensible post content.---

At the end of this project:
===========================

[](#at-the-end-of-this-project)

Extend the Blog Helpers project into a proper “Publishing Module” — one that can be run as a CLI command (php blog-helpers publish) to automatically regenerate RSS + Sitemap + image metadata for sites. That would make it a production-grade tool.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance67

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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 ~0 days

Total

3

Last Release

197d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3224879e88be5094a5f15fe341f284e47815e9c658a4c4d957a9212d29b395d?d=identicon)[ridenzy](/maintainers/ridenzy)

---

Top Contributors

[![ridenzy](https://avatars.githubusercontent.com/u/85450233?v=4)](https://github.com/ridenzy "ridenzy (48 commits)")

---

Tags

phphelperscontentblogseo

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ridenzy-lbh/health.svg)

```
[![Health](https://phpackages.com/badges/ridenzy-lbh/health.svg)](https://phpackages.com/packages/ridenzy-lbh)
```

###  Alternatives

[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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