Coder Social home page Coder Social logo

fatsecret-laravel's Introduction

FatSecret API for Laravel

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.

fatsecret-laravel's People

Contributors

braunson avatar mazedlx avatar namelivia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fatsecret-laravel's Issues

error while setup in laravel5.2

Call to undefined method [package]
ServiceProvider->__call('package', array('braunson/fat-secret')) in FatSecretServiceProvider.php line 21

I have installed "braunson/fatsecret-laravel": "^5.0"
do reply soon

Support laravel 5.2.*?

I'm trying to install your lib but I get this:

$  composer require "braunson/fatsecret-laravel:dev-master"
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for braunson/fatsecret-laravel dev-master -> satisfiable by braunson/fatsecret-laravel[dev-master].
    - Conclusion: remove laravel/framework v5.2.31
    - Conclusion: don't install laravel/framework v5.2.31
    - braunson/fatsecret-laravel dev-master requires illuminate/support 4.2.* -> satisfiable by illuminate/support[v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
    - don't install illuminate/support v4.2.1|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.12|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.16|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.17|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.2|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.3|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.4|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.5|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.6|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.7|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.8|don't install laravel/framework v5.2.31
    - don't install illuminate/support v4.2.9|don't install laravel/framework v5.2.31
    - Installation request for laravel/framework (locked at v5.2.31, required as 5.2.*) -> satisfiable by laravel/framework[v5.2.31].


Installation failed, reverting ./composer.json to its original content.

hmm:

Installation request for laravel/framework (locked at v5.2.31, required as 5.2.*) -> satisfiable by laravel/framework[v5.2.31]

. ?

My composer.json:

    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.