Download the PHP package eher/chegamos-lib without Composer

On this page you can find all versions of the php package eher/chegamos-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chegamos-lib

Chegamos-lib Build Status

Utilize o make para interagir com o projeto.

Exemplos

Os exemplos esperam que você tenha um Autoloader configurado e que tenha suas chaves de acesso à API.

Todos os exemplos devem começar com:

<?php

use chegamos\rest\client\Curl as RestClient;
use chegamos\rest\auth\BasicAuth;
use chegamos\entity\Config;
use chegamos\entity\repository\UserRepository;
use chegamos\entity\repository\PlaceRepository;

use chegamos\entity\City;
use chegamos\entity\Address;
use chegamos\entity\Point;

$key = "ConsumerKey";
$secret = "ConsumerSecret";

$config = new Config();
$config->setBaseUrl("http://api.apontador.com.br/v1/");
$config->setBasicAuth(
    new BasicAuth($key, $secret)
);
$config->setRestClient(
    new RestClient()
);

Repositório de locais

$placeRepository = new PlaceRepository($config);

Pegar dados de um local:

$place = $placeRepository->get("UCV34B2P");
var_dump($place);

Pegar dados de um local com as avaliações:

$place = $placeRepository->byId("UCV34B2P")
->withReviews()
->get();
var_dump($place);

Pegar dados de um local com as fotos:

$place = $placeRepository->byId("UCV34B2P")
->withPhotos()
->get();
var_dump($place);

Listar locais perto de um endereço (CEP)

$places = $placeRepository->byZipcode("18040690")
->getAll();
var_dump($places);

Listar locais perto de um endereço (CEP) filtrando por categoria

$places = $placeRepository->byZipcode("18040690")
->withCategoryId("043") // Associacoes E Sindicatos
->getAll();
var_dump($places);

Listar locais perto de um endereço (CEP) filtrando por subcategoria

$places = $placeRepository->byZipcode("18040690")
->withSubcategoryId("6661") // Associacoes Beneficentes
->getAll();
var_dump($places);

Listar locais perto de um endereço (CEP) filtrando por nome

$places = $placeRepository->byZipcode("18040690")
->withName("Cafe")
->getAll();
var_dump($places);

Listar locais de uma cidade (Cidade, UF)

$city = new City();
$city->setName("São Paulo");
$city->setState("SP");

$address = new Address();
$address->setCity($city);

$places = $placeRepository->byAddress($address)
->getAll();
var_dump($places);

Listar locais através de coordenadas geográficas

$point = new Point();
$point->setLat("-23.51241");
$point->setLng("-47.46828");

$places = $placeRepository->byPoint($point)
->withName("Cafe")
->getAll();
var_dump($places);

Repositório de usuários

$userRepository = new UserRepository($config);

Pegar dados de um usuário:

$user = $userRepository->get("8972911185");
var_dump($user);

Pegar dados de um usuário com as avaliações:

$user = $userRepository->byId("8972911185")
->withReviews()
->get();
var_dump($user);

Pegar dados de um usuário com a segunda página de avaliações:

$user = $userRepository->byId("8972911185")
->withReviews()
->page(2)
->get();
var_dump($user);

Buscar usuário por nome

$userList = $userRepository->byName("Eher")
->getAll();
var_dump($userList);

Buscar usuário por email

$userList = $userRepository->byEmail("[email protected]")
->getAll();
var_dump($userList);

Curl ou Guzzle

O Guzzle é uma forma muito simpática de trabalhar com REST sem ter que lidar direto com o Curl. Nos exemplos acima, nós usamos o Curl por não depender de outro projeto, mas é recomendado usar Guzzle.

Para mudar de Curl para Guzzle basta mudar a linha:

use chegamos\rest\client\Curl as RestClient;

para

use chegamos\rest\client\Guzzle as RestClient;

All versions of chegamos-lib with dependencies

PHP Build Version
Package Version
Requires php Version ~5.3
guzzlehttp/guzzle Version ~5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eher/chegamos-lib contains the following files

Loading the files please wait ....