Skip to content

Biblioteca API para integração com o webservice do SaaS FSPHP

License

Notifications You must be signed in to change notification settings

weidmaster/cafeapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CaféApi Library Test

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

CaféApi Library is a small set of classes developed in UpInside's Full Stack PHP Developer training for integration into the webservice of a SaaS platform developed in the course..

CaféApi Library é um pequeno conjunto de classes desenvolvidas na formação Full Stack PHP Developer da UpInside para integração ao webservice de uma plataforma SaaS desenvolvida no curso.

Você pode saber mais clicando aqui.

Highlights

  • Simple installation (Instalação simples)
  • Abstraction of all API methods (Abstração de todos os métodos da API)
  • Easy authentication with login and password (Fácil autenticação com login e senha)
  • Composer ready and PSR-2 compliant (Pronto para o composer e compatível com PSR-2)

Installation

Uploader is available via Composer:

"weidmaster/cafeapi": "^1.0"

or run

composer require weidmaster/cafeapi

Documentation

For details on how to use, see a sample folder in the component directory. In it you will have an example of use for each class. It works like this:

Para mais detalhes sobre como usar, veja uma pasta de exemplo no diretório do componente. Nela terá um exemplo de uso para cada classe. Ele funciona assim:

User endpoint:

<?php

require __DIR__ . "/../vendor/autoload.php";

use WeidMaster\CafeApi\Me;

$me = new Me(
    "suaapi.url.com",
    "[email protected]",
    "suasenha"
);

//me
$user = $me->me();

//update
$user->update([
    "first_name" => "Robson",
    "last_name" => "Leite",
    "genre" => "male",
    "datebirth" => "1980-01-02",
    "document" => "888888888"
]);

//photo
$user->photo($_FILES["photo"]);

//test and result
if ($user->error()) {
    $user->error(); //object
} else {
    $user->response(); //object
}

Invoices endpoint:

<?php

require __DIR__ . "/../vendor/autoload.php";

use WeidMaster\CafeApi\Invoices;

$invoices = new Invoices(
    "suaapi.url.com",
    "[email protected]",
    "suasenha"
);

//index
$index = $invoices->index(null);

//index filter
$index = $invoices->index([
    "wallet_id" => 23,
    "type" => "fixed_income",
    "status" => "paid",
    "page" => 2
]);

//create
$invoices->create([
    "wallet_id" => 23,
    "category_id" => 3,
    "description" => "Pagamento Cartão",
    "type" => "expense",
    "value" => "25000.20",
    "due_at" => "2019-10-02",
    "repeat_when" => "single",
    "period" => "month",
    "enrollments" => "1",
]);

//read
$invoices->read(91);

//update
$invoiceId = 91;
$invoices->update($invoiceId, [
    "wallet_id" => 23,
    "category_id" => 3,
    "description" => "Pagamento Cartão",
    "value" => "25000.20",
    "due_day" => 25,
    "status" => "paid"
]);

//delete
$invoices->delete(91);

//test and result
if ($invoices->error()) {
    $invoices->error(); //object
} else {
    $invoices->response(); //object
}

Others

You also have classes for endpoints of portfolios and signatures, all the documentation of use with practical examples is available in the examples folder library. Please check there.

Você também conta com classes para os endpoints de carteiras e assinaturas, toda documentação de uso com exemplos práticos está disponível na pasta examples desta biblioteca. Por favor, consulte lá.

Contributing

Please see CONTRIBUTING for details.

Support

Security: If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Se você descobrir algum problema relacionado à segurança, envie um e-mail para [email protected] em vez de usar o rastreador de problemas.

Thank you

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Biblioteca API para integração com o webservice do SaaS FSPHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published