PHPackages                             halaabusalim/laravel-dynamic-placeholder - 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. halaabusalim/laravel-dynamic-placeholder

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

halaabusalim/laravel-dynamic-placeholder
========================================

A Laravel package to generate context-aware placeholder content.

v1.0.0(11mo ago)01MITPHPPHP ^8.0

Since Jul 28Pushed 11mo agoCompare

[ Source](https://github.com/HalaSalim77/laravel-dynamic-placeholder)[ Packagist](https://packagist.org/packages/halaabusalim/laravel-dynamic-placeholder)[ RSS](/packages/halaabusalim-laravel-dynamic-placeholder/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel Dynamic Placeholder
===========================

[](#laravel-dynamic-placeholder)

A Laravel package to generate context-aware placeholder content for your applications.

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

[](#installation)

1. Install the package via Composer:

```
composer require halaabusalim/laravel-dynamic-placeholder
```

2. Publish the configuration file:

```
php artisan vendor:publish --provider="Halaabusalim\LaravelDynamicPlaceholder\DynamicPlaceholderServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use Halaabusalim\LaravelDynamicPlaceholder\Facades\DynamicPlaceholder;

// Generate text placeholders
$productName = DynamicPlaceholder::text('ecommerce.product_name');
$blogTitle = DynamicPlaceholder::text('blog.title');

// Generate number placeholders
$price = DynamicPlaceholder::number('ecommerce.price');

// Generate image placeholders
$imageUrl = DynamicPlaceholder::image('product-image');
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use Halaabusalim\LaravelDynamicPlaceholder\DynamicPlaceholder;

class ProductController extends Controller
{
    public function __construct(private DynamicPlaceholder $placeholder)
    {
    }

    public function index()
    {
        $productName = $this->placeholder->text('ecommerce.product_name');
        $price = $this->placeholder->number('ecommerce.price');

        return view('products.index', compact('productName', 'price'));
    }
}
```

Configuration
-------------

[](#configuration)

The package comes with a configuration file that you can customize. Edit `config/dynamic-placeholder.php`:

```
return [
    'contexts' => [
        'ecommerce' => [
            'product_name' => ['Laptop', 'Smartphone', 'Headphones', 'Smartwatch'],
            'description' => [
                'High-performance device for professionals.',
                'Sleek design with cutting-edge technology.',
                'Perfect for everyday use.'
            ],
            'price' => ['min' => 50, 'max' => 1000],
        ],
        'blog' => [
            'title' => ['Top 10 Tips for Success', 'How to Start a Blog', 'The Future of Tech'],
            'content' => ['Lorem ipsum dolor sit amet...', 'In this article, we explore...'],
        ],
    ],
];
```

Methods
-------

[](#methods)

### `text(string $context): string`

[](#textstring-context-string)

Returns a random text from the configured context.

### `number(string $context): float`

[](#numberstring-context-float)

Returns a random number within the configured range.

### `image(string $context): string`

[](#imagestring-context-string)

Returns a placeholder image URL (currently uses via.placeholder.com).

Testing
-------

[](#testing)

### Running Tests

[](#running-tests)

1. **Unit Tests with PHPUnit:**

```
./vendor/bin/phpunit
```

2. **Manual Testing:**

```
php test-manual.php
```

### Test Coverage

[](#test-coverage)

The test suite covers:

- ✅ Text placeholder generation
- ✅ Number placeholder generation with ranges
- ✅ Image placeholder URL generation
- ✅ Error handling for missing contexts
- ✅ Facade functionality
- ✅ Service provider registration
- ✅ Configuration merging
- ✅ Singleton pattern verification

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance51

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

341d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/82084034?v=4)[Hala Abusalim](/maintainers/HalaSalim77)[@HalaSalim77](https://github.com/HalaSalim77)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/halaabusalim-laravel-dynamic-placeholder/health.svg)

```
[![Health](https://phpackages.com/badges/halaabusalim-laravel-dynamic-placeholder/health.svg)](https://phpackages.com/packages/halaabusalim-laravel-dynamic-placeholder)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M376](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.6M136](/packages/illuminate-cookie)

PHPackages © 2026

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