定制 medienbaecker/kirby-playground 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

medienbaecker/kirby-playground

最新稳定版本:1.1.1

Composer 安装命令:

composer require medienbaecker/kirby-playground

包简介

Kirby Playground

README 文档

README

An overview of different button styles

Usage

  1. Create your tests as snippets in /site/snippets/playground/
  2. Access your tests at /playground/[component-name]

For example, if you have a snippet named buttons.php, it will be available at /playground/buttons.

Features

  • Custom route handling for /playground/(:any?) that can optionally be restricted to logged-in users
  • Components are rendered through virtual pages, without requiring actual page files
  • Loads CSS files from assets/css/playground/[component-name].css and a global playground.css
  • Built-in fallback to a component list when accessing non-existent components
  • Placeholder helpers for lorem ipsum text and images

Placeholder Content

Generate placeholder content directly in your playground snippets (or anywhere else) by using the Playground class:

use Medienbaecker\Playground;

Text

Playground::text([
    // word count (default: 20)
    'words' => 50,
    'words' => [30, 60],

    // wrap in <p> tags (default: false)
    'paragraphs' => false,
    'paragraphs' => true,
    'paragraphs' => 3,
    'paragraphs' => [2, 5],

    // insert random <a> tags (default: false)
    'links' => false,
    'links' => true,
    'links' => 2,
    'links' => [1, 3],

    // insert random <strong> tags (default: false)
    'bold' => false,
    'bold' => true,
    'bold' => 1,
    'bold' => [1, 2],

    // insert random <em> tags (default: false)
    'italic' => false,
    'italic' => true,
    'italic' => 1,
    'italic' => [1, 3],

    // start with (default: 'Lorem ipsum ')
    'prefix' => 'Lorem ipsum ',
    'prefix' => false,

    // end with (default: '.')
    'suffix' => '.',
    'suffix' => false,
])

For names, titles, or other non-sentence content, set prefix and suffix to false (or null or ''):

Playground::text(['words' => 5, 'prefix' => false, 'suffix' => false])

This way you will get random words, not starting with Lorem ipsum and not ending with a period.

Images

Returns virtual Kirby File objects with full thumb support:

Playground::image('landscape')->thumb('card')
Playground::image('square')->crop(200, 200)
Playground::images(6) // returns a Files collection

Variants: landscape, portrait, square

Configuration

You can enable authentication to restrict access to logged-in Panel users:

// site/config/config.php
return [
  'medienbaecker.playground.auth' => true
];

Directory Structure

assets/
├── css/
│   └── playground/
│       ├── playground.css
│       └── your-component.css
site/
├── snippets/
│   └── playground/
│       └── your-component.php

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-29