PHPackages                             concrete5/fresh - 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. [Database &amp; ORM](/categories/database)
4. /
5. concrete5/fresh

Abandoned → [concretecms/fresh](/?search=concretecms%2Ffresh)Concrete5-package[Database &amp; ORM](/categories/database)

concrete5/fresh
===============

Concrete CMS database seeder / cleaner

v1.0.2(7y ago)01.2k1[3 PRs](https://github.com/concretecms/fresh/pulls)PHP

Since Oct 26Pushed 3y ago5 watchersCompare

[ Source](https://github.com/concretecms/fresh)[ Packagist](https://packagist.org/packages/concrete5/fresh)[ RSS](/packages/concrete5-fresh/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

So Fresh and so Clean
=====================

[](#so-fresh-and-so-clean)

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

Usage
=====

[](#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
--------

[](#examples)

Seeders use the [`fresh::seeders` config group](https://github.com/concrete5/fresh/blob/master/config/seeders.php) and Cleaners use [`fresh::cleaners`](https://github.com/concrete5/fresh/blob/master/config/cleaners.php). Overrides for these settings will likely end up in `application/config/fresh/seeders.php` and `application/config/fresh/cleaners.php`.

#### Clean the site

[](#clean-the-site)

```
$ ./vendor/bin/concrete5 fresh:clean

```

#### Seed 5 admins and 15 users into your site

[](#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

[](#seed-or-clean-using-a-custom-seeder)

This package can only seed using one seeder or Cleaner at a time. Luckily [aggregate seeders](https://github.com/concrete5/fresh/blob/master/src/Seed/SimpleSeeder.php) and [cleaners](https://github.com/concrete5/fresh/blob/master/src/Clean/SimpleCleaner.php) totally work.

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

```

Customizing
-----------

[](#customizing)

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

### Quick and Dirty

[](#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

[](#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

```
