2017 © Pedro Peláez
 

library fresa

Developing WordPress should be sweet.

image

jplhomer/fresa

Developing WordPress should be sweet.

  • Sunday, December 3, 2017
  • by jplhomer
  • Repository
  • 2 Watchers
  • 18 Stars
  • 143 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 6 Open issues
  • 6 Versions
  • 23 % Grown

The README.md

Fresa

🍓 Developing WordPress should be sweet., (*1)

Use Fresa in your plugins and themes to make interacting with the WordPress ecosystem friendly and fast., (*2)

Tested on WordPress 4.8 and requires PHP 7+. Your mileage may vary., (*3)

use Fresa\PostModel;

class Event extends PostModel
{
    $postType = 'my_custom_post_type';
}

Register your custom post types in one line:, (*4)

Event::register();

Interact with your post in an object-oriented fashion:, (*5)

$event = new Event;
$event->title = 'Hello World.';
$event->venue = 'Times Square';
$event->save();

echo $event->id; // 1
echo $event->venue; // 'Times Square';
// Same as get_post_meta(1, 'venue', true);

And perform queries through a fluent interface:, (*6)

$event = Event::find(1);
$events = Event::where('venue', 'Times Square')
                ->order('date', 'asc')
                ->limit(5)
                ->offset(5)
                ->get();

Queries return a Collection instance:, (*7)

$events->each(function($event) {
    echo $event->title;
});

Installation

composer require jplhomer/fresa

Read the full documentation here., (*8)

Development

composer install

Running Tests

First, set up the required WordPress testing library on your machine:, (*9)

# Replace db-name, db-user, db-pass with arguments of a database to be created
# If you already have a database, pass `true` to the last argument, e.g.
# wptests root '' 127.0.0.1 latest true
./bin/install-wp-tests.sh <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]

Run tests using PHPUnit:, (*10)

vendor/bin/phpunit

The Versions

03/12 2017

dev-master

9999999-dev

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson

03/12 2017

v1.1.2

1.1.2.0

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson

29/08 2017

v1.1.1

1.1.1.0

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson

20/08 2017

v1.1.0

1.1.0.0

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson

14/08 2017

v1.0.1

1.0.1.0

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson

14/08 2017

v1.0.0

1.0.0.0

Developing WordPress should be sweet.

  Sources   Download

MIT

The Requires

 

by Josh Larson