vzgcoders/totk-recipe-calculator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

vzgcoders/totk-recipe-calculator

最新稳定版本:v1.3

Composer 安装命令:

composer require vzgcoders/totk-recipe-calculator

包简介

A cooking calculator for Tears of the Kingdom.

README 文档

README

VZGCoders Discord

Before you start

Before you start using this Library, you need to know how PHP works. This is a fundamental requirement before you start. Without this knowledge, you will only suffer.

FAQ

  1. Can I run TOTK-Recipe-Calculator on a webserver (e.g. Apache, nginx)?
    • Yes! I'm also working on a version that is compatible with the DiscordPHP Library that will only run in CLI. If that's what you're looking for, you can find it here (unless it's still in development, in which case the repository is still set to private).

Getting Started

Requirements

  • PHP 8.0
  • Composer

Recommended Extensions

  • The latest PHP version.

Basic Configuration-

use \TOTK\Crafter;
use \TOTK\Helpers\Collection;
use \TOTK\Parts\Ingredient;

ini_set('display_errors', 1);
error_reporting(E_ALL);
set_time_limit(0);
ignore_user_abort(1);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1'); //Unlimited memory usage
if (! @include getcwd() . '/vendor/autoload.php') { //If you clone the GitHub project instead of using Composer we will need to load these classes manually
    include __DIR__ . '/src/TOTK/crafter.php';
    include __DIR__ . '/src/TOTK/Helpers/collection.php';
    include __DIR__ . '/src/TOTK/Parts/ingredient.php';
}

//This is what will be used to calculate meals from a list of ingredients
$crafter = new Crafter();

//For ease of use, create a Collection to retrieve a list of ingredients
if (! $materials_file = @file(__DIR__ . '\vendor\vzgcoders\totk-recipe-calculator\src\TOTK\CSVs\materials.csv')) $materials_file = file(__DIR__ . '\src\TOTK\CSVs\materials.csv');
$csv = array_map('str_getcsv', $materials_file);
$keys = array_shift($csv);
$materials = array();
foreach ($csv as $row) $materials[] = array_combine($keys, $row);
$materials_collection = new Collection([], $keys[2]);
foreach ($materials as $array) $materials_collection->pushItem($array);

// Pick out some ingredients for your recipe. This is an example for Fruitcake.
$ingredient1 = new Ingredient($materials_collection->get('Euen name', 'Apple'));
$ingredient2 = new Ingredient($materials_collection->get('Euen name', 'Wildberry'));
$ingredient3 = new Ingredient($materials_collection->get('Euen name', 'Cane Sugar'));
$ingredient4 = new Ingredient($materials_collection->get('Euen name', 'Tabantha Wheat'));
$ingredient5 = null;

//Throw the array into the crafter and display the results
$ingredients = [$ingredient1 ?? NULL, $ingredient2 ?? NULL, $ingredient3 ?? NULL, $ingredient4 ?? NULL, $ingredient5 ?? NULL];
var_dump('[MEAL]', $meal = $crafter->process($ingredients));

See main.php for function examples.

Contributing

We are open to contributions, just open a pull request and we will review it.

License

MIT License, © Valithor Obsidion and other contributers 2023-present.

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固