Code Monkey home page Code Monkey logo

wefact's Introduction

WeFact API 2.7 for Laravel 5

Build Status

Official documentation:

Installation

Install using composer:

composer require hyperized/wefact

This package supports Package Auto-Discovery (Laravel 5.5+) so it doesn't require you to manually add the ServiceProvider and alias.

If you are using a lower version of Laravel or not using Auto-Discovery you can add the WeFact Service Provider to the config/app.php file

Hyperized\Wefact\WefactServiceProvider::class,

Register a alias for Wefact, also in config/app.php:

'Wefact'    => Hyperized\Wefact\WefactServiceProvider::class,

Now publish the Wefact package into your installation:

php artisan vendor:publish --provider="Hyperized\Wefact\WefactServiceProvider" --tag="config"

This should give you a message like: Copied File [/vendor/hyperized/wefact/src/config/Wefact.php] To [/config/Wefact.php]

It's possible to edit your configuration variables in the config/Wefact.php file or you can use the WEFACT_URL and WEFACT_KEY environment variables to store sensitive information in the .env file

// config/Wefact.php
'api_v2_url'		=> env('WEFACT_URL', 'https://yoursite.tld/Pro/apiv2/api.php'),
'api_v2_key'		=> env('WEFACT_KEY', 'token'),
'api_v2_timeout'	=> 10,

// .env/.env.example
WEFACT_URL=https://yoursite.tld/Pro/apiv2/api.php
WEFACT_KEY=token

Example code:

// Direct use
$product = new Hyperized\Wefact\Types\Product();
$productParams = [
    'searchfor' => 'invoice'
];
$output = $product->list($productParams);

// Use in Controllers
use Hyperized\Wefact\Types\Product;

class MyController extends Controller {
    public function getProducts()
    {
        $product = new Product();
        $productParams = [
            'searchfor' => 'invoice'
        ];
        return $product->list($productParams);
    }
}

wefact's People

Contributors

hyperized avatar bitency avatar nickurt avatar caroga avatar casdr avatar jensmombaerts avatar chrisriteco avatar

Watchers

Koen avatar

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.