jplarar / enviapaqueteria-bundle
A simple Symfony2 bundle for Envia API.
Installs: 105
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5
- symfony/config: ^2.0 || ^3.0 || ^4.0
- symfony/dependency-injection: ^2.0 || ^3.0 || ^4.0
- symfony/framework-bundle: ^2.0 || ^3.0 || ^4.0
- symfony/http-foundation: ^2.0 || ^3.0 || ^4.0
- symfony/http-kernel: ^2.0 || ^3.0 || ^4.0
- symfony/options-resolver: ^2.0 || ^3.0 || ^4.0
- symfony/security: ^2.0 || ^3.0 || ^4.0
- symfony/validator: ^2.0 || ^3.0 || ^4.0
This package is auto-updated.
Last update: 2025-04-05 02:13:55 UTC
README
A simple Symfony2 bundle for the API for Envia Paqueteria API.
Setup
Step 1: Download JplararEnviapaqueteriaBundle using composer
Add SES Bundle in your composer.json:
{ "require": { "jplarar/enviapaqueteria-bundle": "dev-master" } }
Now tell composer to download the bundle by running the command:
$ php composer.phar update "jplarar/enviapaqueteria-bundle"
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Jplarar\EnviapaqueteriaBundle\EnviapaqueteriaBundle() ); }
Step 3: Add configuration
# app/config/config.yml jplarar_enviapaqueteria: enviapaqueteria_keys: enviapaqueteria_user: %enviapaqueteria_user% enviapaqueteria_password: %enviapaqueteria_password% enviapaqueteria_environment: %enviapaqueteria_environment% # 'prod' or 'dev'
Usage
Using service
<?php $enviapaqueteriaClient = $this->get('enviapaqueteria_client'); ?>
##Example
###Generate Quote
<?php $quotes = $enviapaqueteriaClient->quote( $origin = [ "representative" => "Origen test", "company" => "Origen Empresa", "email" => "correo@pruebas.com", "phone" => "8111234567", "country" => "MX", "address1" => "av vasconcelos", "address2" => "1400", "addressExtra" => "enfrente de office depot", "zipCode" => "66240" ], $destination = [ "representative" => "Destino test", "company" => "Origen Empresa", "email" => "correo@pruebas.com", "phone" => "8111234567", "country" => "MX", "address1" => "av vasconcelos", "address2" => "1400", "addressExtra" => "enfrente de office depot", "zipCode" => "66240" ], $options = [ "content" => "vestido", "insurance" => 0, "value" => "", "height" => 10, "width" => 10, "length" => 10, "weight" => 2, "amount" => 1, "collection" => null, "collection_time" => "", "collection_time_limit" => "", "collection_date" => "" ] ); $shipping = $enviapaqueteriaClient->create( $provider = [ "name" => "fedex", "service" => "FEDEX_EXPRESS_SAVER" ], $origin = [ "representative" => "Origen test", "company" => "Origen Empresa", "email" => "correo@pruebas.com", "phone" => "8111234567", "country" => "MX", "address1" => "av vasconcelos", "address2" => "1400", "addressExtra" => "enfrente de office depot", "zipCode" => "66240" ], $destination = [ "representative" => "Destino test", "company" => "Origen Empresa", "email" => "correo@pruebas.com", "phone" => "8111234567", "country" => "MX", "address1" => "av vasconcelos", "address2" => "1400", "addressExtra" => "enfrente de office depot", "zipCode" => "66240" ], $options = [ "content" => "vestido", "insurance" => 0, "value" => "", "height" => 10, "width" => 10, "length" => 10, "weight" => 2, "amount" => 1, "collection" => null, "collection_time" => "", "collection_time_limit" => "", "collection_date" => "", "file" => "PDF", "paper" => "PAPER_7X4.75", ] ); ?>