jplarar / enviapaqueteria-bundle
一个简单的用于 Envia API 的 Symfony2 扩展包。
2.1.0
2020-09-04 16:33 UTC
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: 2024-09-05 00:48:59 UTC
README
一个简单的用于 Envia Paqueteria API 的 Symfony2 扩展包。
安装
步骤 1: 使用 composer 下载 JplararEnviapaqueteriaBundle
在 composer.json 中添加 SES 扩展包
{ "require": { "jplarar/enviapaqueteria-bundle": "dev-master" } }
现在运行以下命令让 composer 下载扩展包
$ php composer.phar update "jplarar/enviapaqueteria-bundle"
步骤 2: 启用扩展包
在内核中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Jplarar\EnviapaqueteriaBundle\EnviapaqueteriaBundle() ); }
步骤 3: 添加配置
# app/config/config.yml jplarar_enviapaqueteria: enviapaqueteria_keys: enviapaqueteria_user: %enviapaqueteria_user% enviapaqueteria_password: %enviapaqueteria_password% enviapaqueteria_environment: %enviapaqueteria_environment% # 'prod' or 'dev'
使用方法
使用服务
<?php $enviapaqueteriaClient = $this->get('enviapaqueteria_client'); ?>
##示例
###生成报价
<?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", ] ); ?>