定制 braunson/fatsecret-laravel 二次开发

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

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

braunson/fatsecret-laravel

最新稳定版本:5.1.0

Composer 安装命令:

composer require braunson/fatsecret-laravel

包简介

A PHP FatSecret API library for Laravel

README 文档

README

StyleCI Build Status codecov

The FatSecret API for Laravel gives you access to the FatSecret API.

FatSecret provides you with access to comprehensive nutrition data for many thousands of foods, not to mention a range exercises and great weight management tools for your applications.

Requirements

  • Laravel versions: 5.6, 5.7 and 5.8

Looking for 4.x Compatibility?

While it may be unsupported now, you can find 4.x compatible versions in the laravel4 branch or tagged with 4.0

How to Install

  1. Install the braunson/fatsecret-laravel package

    $ composer require "braunson/fatsecret-laravel"
  2. Update config/app.php to activate FatSecret package

    # Add `FatSecretServiceProvider` to the `providers` array
    'providers' => [
    	...
    	Braunson\FatSecret\ServiceProvider::class,
    ]
    
    # Add the FatSecret Facade to the `aliases` array
    'aliases' => [
    	...
    	'FatSecret' => Braunson\FatSecret\Facades\Facade::class,
    ]

Configuration

  1. Publish the config file:

    php artisan vendor:publish --provider="Braunson\FatSecret\ServiceProvider"
  2. Open your .env file and add in

    FATSECRET_KEY=YOUR-API-KEY
    FATSECRET_SECRET=YOUR-API-SECRET
    

Usage

When you are using this package in a file, make sure to add this to the top of your file:

use Fatsecret;

The FatSecret is available as FatSecret, for example:

FatSecret::ProfileCreate($userID, &$token, &$secret);

For more information on using the FatSecret API check out the documentation

Methods

FatSecret::searchIngredients($search_phrase, $page, $maxresults)
  • Search ingredients by phrase, page and max results
FatSecret::getIngredient($ingredient_id)
  • Retrieve an ingredient by ID
FatSecret::GetKey()
  • Gets the set consumer key
FatSecret::SetKey()
  • Allows overriding or setting of the consumer key
FatSecret::GetSecret()
  • Gets the set secret key
FatSecret::SetSecret()
  • Allows overriding or setting of the secret key
FatSecret::ProfileCreate($userID, $token, $secret)
  • Allows creation of a profile in FS with a user specific ID.
FatSecret::ProfileGetAuth($userID, $token, $secret)
  • Get the authentication details of a profile
FatSecret::ProfileRequestScriptSessionKey($auth, $expires, $consumeWithin, $permittedReferrerRegex, $cookie, $sessionKey)
  • Create a new session for JavaScript API users

Reporting Bugs or Feature Requests

Please report any bugs or feature requests on the github issues page for this project here:

https://github.com/braunson/fatsecret/issues

Contributing

License

The FatSecret Laravel API is free software released under the MIT License. See LICENSE for details. This is not an official release and is released separately from FatSecret.

统计信息

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

GitHub 信息

  • Stars: 19
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-12