Download the PHP package kerns/dummy without Composer

On this page you can find all versions of the php package kerns/dummy. 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 dummy

Dummy

Dummy fills PHP templates with placeholder content and helps you test how a layout behaves when that content changes. Generate lorem ipsum at a chosen length, crop local images, show an element some of the time, or repeat a block a random number of times.

It works in plain PHP and Laravel. The original dummy(), dumb_luck(), and dumb_question() syntax is preserved, with no third-party runtime dependencies.

Reload the page to explore a different combination of text, images, and layout elements.

Requirements

Compatibility has been tested on actual PHP 8.3, 8.4, and 8.5 runtimes with both Laravel versions. See verification results. Dummy does not need a database, Docker, or a native PHP session.

Try the demo

View the demo and documentation.

To run the PHP demo locally, use this command from the Dummy directory:

Open localhost:8000/demo.php. The demo includes installation instructions, working examples, copyable snippets, image thumbnails, and guidance for high-density displays. PHP needs write access to dummy/cache, or permission to create that directory.

The online examples stay the same between visits. Run the demo locally for fresh random content on each reload.

Install with Composer

Composer loads the global helper functions automatically. Keep Dummy as a development dependency for prototyping and QA. Follow the Laravel or standalone PHP setup below to make the assets available to your application.

Laravel and Blade

After the Composer installation, publish the bundled assets:

Laravel discovers Dummy's service provider automatically. Assets are published to public/vendor/dummy/assets; generated crops go into public/vendor/dummy/cache. The web server needs permission to create and write to the cache directory. Dummy does not write into Composer's vendor directory.

Create resources/views/dummy-demo.blade.php:

dummy() prints its result, so use @php(...) rather than Blade's escaped {{ ... }} output.

Add a route in routes/web.php:

Start your application with its normal development command, or php artisan serve, and open /dummy-demo.

To change asset paths or the URL prefix:

Edit config/dummy.php before publishing assets to the new location. Its defaults are:

The URL must serve the matching asset and cache directories. Rebuild cached configuration with php artisan config:cache after changes. Dummy resets its image-selection, loop, and file-pool state with Laravel's request lifecycle, including request rebinding in long-lived workers.

Composer in a standalone PHP project

After installing the package, copy the assets into your public directory:

Create public/demo.php:

Make the cache writable by PHP, then run php -S localhost:8000 -t public from your application directory. Open localhost:8000/demo.php.

Generated lorem ipsum works without copying assets. Named text pools, images, and ads need the asset files.

Plain PHP without Composer

Copy the entire dummy directory into your public web root and include it before calling the helpers:

Keep dummy.php, Runtime.php, Lorem.php, and the assets together. PHP needs write access to dummy/cache, or permission to create it. Use standard ` tags; legacy calling templates that use short tags still need PHP'sshort_open_tag` setting.

For a different public location, set $dummy_path, $dummy_assets_path, and $dummy_cache_path before rendering. The first is a URL prefix; the other two are filesystem paths. Inside a function, set them through $GLOBALS.

Generated lorem ipsum

Use a single count for an exact length, or a range for a random length on each call:

Command Output
text@words:50 Exactly 50 words
text@words:30-60 Between 30 and 60 words
text@words:5-9,title Between 5 and 9 words, title cased
text@sentences:3 Exactly 3 sentences
text@sentences:2-4 Between 2 and 4 sentences
text@paragraphs:2-3 Between 2 and 3 paragraphs

Output is plain text from a built-in lorem corpus. ,title capitalizes every word, including short words, and preserves punctuation. Without it, output uses normal sentence casing.

Ranges include both endpoints; reversed ranges work too. Zero prints nothing. Counts must be whole numbers, with per-call limits of 10,000 words, 1,000 sentences, or 100 paragraphs. Invalid counts print a Dummy error.

Each paragraph contains 3–6 sentences. Paragraphs are separated by blank lines; use your own markup or white-space: pre-line to display those breaks.

Named text pools

Existing commands such as text@headline, text@teaser, text@paragraph, text@author, and text@date still select content from the corresponding files in assets/text. Add or edit these files to make your own pools.

Names without a colon remain file selections: text@words reads words.txt, while text@words:50 generates text. Text pools and ad templates can execute PHP, as in the original release; use trusted local asset files.

Images and ads

Image commands print a URL for an <img> element's src attribute:

Command Result
image@480x320 A 480×320 center crop
image@640x,16:9 A 16:9 crop, 640 pixels wide
image@x200,16:9 A 16:9 crop, 200 pixels high
image/landscape@3:2 A 3:2 crop selected from the landscape folder
image/!avatar@150x150 A 150×150 crop from the explicitly selected avatar folder

Aspect-ratio-only commands crop at the source's available resolution. Request dimensions are image pixels. For high-density displays, request more pixels and set the CSS display size separately:

The bundled image/retina folder contains 2048×1536 sources. Some older photos have fewer pixels; enlarging them cannot restore missing detail.

JPEG, PNG, and GIF crops are supported. Transparency is preserved. Image selection avoids repeats until its pool is exhausted. Folders beginning with ! are excluded from general selection and can be targeted explicitly.

Defaults include JPEG_QUALITY = 90, MAX_WIDTH_PX = 2048, and MAX_HEIGHT_PX = 1536. Set constants before loading Dummy or Composer's autoloader. Use a fresh image cache when changing JPEG quality. Crops are generated in one GD pass, cached per source and size, and written atomically.

The original direct endpoint, such as /dummy/dummy.php?image@640x,16:9, works in a drop-in installation. Laravel uses the published asset and cache URLs.

dummy('ad@120x90') prints complete ad markup using the templates in assets/ad. Legacy Flash markup remains opt-in through $flash_ads = true; current browsers do not support Flash.

Probability, loops, and request helpers

Use if with percentages and while with counts or ranges. Nested loops keep their own positions. Inside a loop, dumb_question('order:first'), dumb_question('order:last'), and dumb_question('order:inner') return booleans; dumb_luck('') prints the one-based item number.

dumb_question('url:mode=compact') tests query parameters. dumb_question('segment:1=news') tests URL path segments, numbered from one. Laravel uses the current request; plain PHP uses PATH_INFO or REQUEST_URI. The optional legacy Apache rewrite's dummyurl parameter is also supported.

Contributing

See the verification report lists tested versions and fresh-project installation results.

License and credits

Dummy retains its original CREDITS.md. The demo's bundled Highlight.js code uses its included BSD 3-Clause license.


All versions of dummy with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-gd Version *
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 kerns/dummy contains the following files

Loading the files please wait ...