定制 concretecms/fresh 二次开发

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

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

concretecms/fresh

Composer 安装命令:

composer require concretecms/fresh

包简介

Concrete CMS database seeder / cleaner

README 文档

README

The concrete5 fresh package makes it simple to clean a database or seed it with fresh data.

Usage

Fresh adds two new commands to a concrete5 install:

  • concrete5 fresh:clean [cleaner?] To clean (destroy) data and leave you with something clean that is safer to share
  • concrete5 fresh:seed [seeder?] To seed data into your concrete5 install

Examples

Seeders use the fresh::seeders config group and Cleaners use fresh::cleaners. Overrides for these settings will likely end up in application/config/fresh/seeders.php and application/config/fresh/cleaners.php.

Clean the site

$ ./vendor/bin/concrete5 fresh:clean

Seed 5 admins and 15 users into your site

$ ./vendor/bin/concrete5 c5:config set fresh::seeders.admins 5
$ ./vendor/bin/concrete5 c5:config set fresh::seeders.users 15
$ ./vendor/bin/concrete5 fresh:seed

Seed or Clean using a custom seeder

This package can only seed using one seeder or Cleaner at a time. Luckily aggregate seeders and cleaners totally work.

./vendor/bin/concrete5 fresh:seed "\Some\Custom\Seeder"
./vendor/bin/concrete5 fresh:clean "\Some\Custom\Cleaner"

Customizing

Fresh is really easy to customize with your own cleaners / seeders. A few ways to get started are listed below

Quick and Dirty

If you're working to test something, or needing to quickly clean things from your install without permanent changes to your project, you may just want a simple entry point for custom functionality.

In your /application/bootstrap/app.php you can define your cleaner / seeder:

// Override `fresh::cleaners.cleaner` config entry
$app['config']['fresh::cleaners.cleaner'] = new Class() extends \PortlandLabs\Fresh\Clean\Cleaner {

    public function run()
    {
        $this->output->section('Custom Cleaner!');
    }
};

Maintainable and happy

Rather than making a quick and dirty anonymous class, let's use configuration to point to a class that exists in our namespace.

First make sure you have a class that exists in your namespace, in this example we're using \PortlandLabs\FooBaz\CleanRoutine.

Next override the fresh::cleaners.cleaner or the fresh::seeders.seeder config item

<?php

return [
    'cleaner' => '\PortlandLabs\FooBaz\CleanRoutine'
];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-05-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固