/object-oriented-php

Object Oriented PHP sample

Primary LanguagePHP

Object Oriented PHP sample

A PHP Cookbook

Basic Usage

list all recipes with corresponding id
echo Render::listRecipes($cookbook->getRecipeTitles());

display recipe by id
echo Render::displayRecipe($cookbook->filterById(7));

add new collection, and display filtered by tag
$breakfast = new RecipeCollection("Breakfast foods");

foreach ($cookbook->filterByTag("breakfast") as $recipe) { $breakfast->addRecipe($recipe); }

echo Render::listRecipes($breakfast->getRecipeTitles());

Display shopping list of ingredients for "Breakfast" Collection
echo Render::listShopping($breakfast->getCombinedIngredients());