Download the PHP package sergeevpasha/laravel-pecom without Composer

On this page you can find all versions of the php package sergeevpasha/laravel-pecom. 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 laravel-pecom

Maintainability Test Coverage CodeFactor Generic badge Generic badge

Laravel PECOM API Wrapper

Allows you to:

Pre-requirements

You need to get Pecom API key and login. Key can be obtained in your cabinet at https://kabinet.pecom.ru/profile

Installation

composer require sergeevpasha/laravel-pecom

Configuration

This package has a few configuration values:

'key'        => env('PECOM_KEY', null),
'user'       => env('PECOM_USER', null),
'prefix'     => 'pecom',
'middleware' => ['web']

If you only need to use PecomClient, you may completely skip this configuration. Otherwise, you can use default options and just specify PECOM_KEY and PECOM_USER at .env file. To make full use of predefined routes, you will need to publish config:

php artisan vendor:publish --provider="SergeevPasha\Pecom\Providers\PecomServiceProvider" --tag="config"

Now you can change routes prefix and middleware to whatever you need

Use Case #1

After installing, you may just import the client

use SergeevPasha\Pecom\Libraries\PecomClient;

Now you need to initialize it:

$client = new PecomClient('user', 'key');

Now we can use these methods:

$client->findCity(string $query)
$client->getCityTerminals(int $cityId)
/* This one requires a Delivery Object, see next to see how to build it */
$client->getPrice(Delivery $delivery)

Delivery Object

To build a Delivery object you will need to pass an array to fromArray() method just like that:

Delivery::fromArray([
    'arrival_city_id'                 => '123', // Arrival City ID, can be found using findCity() method
    'derival_city_id'                 => '123456', // Derival City ID, can be found using findCity() method
    'arrival_open_car'                => '1', // Boolean. Removable Curtains for arrival car
    'derival_open_car'                => '1, // Boolean. Removable Curtains for derival car
    'arrival_distance_type'           => '2', // Distance Type, Moscow ONLY
                                                  0 - NONE,
                                                  1 - Require transportation by Sadovoe Koltso
                                                  2 - Require transportation by Moscow district railway
                                                  3 - Require transportation by Third Transport Ring
    'derival_distance_type'           => '0', // Same as arrival
    'one_day_delivery'                => '1', // Boolean, day by day delivery
    'is_shop'                         => '0', // Boolean, sender is a shop
    'pay_date'                        => '2020-10-10', // Payment date
    'arrival_address'                 => '1', // Boolean, if delivery is required (means you are not using terminal)
    'derival_address'                 => '1', // Boolean, if pickup is required
    /* Next fields are not required */
    'require_insurance'               => '1', // Boolean, if you need to insure a cargo
    'insurance_price'                 => '100.50', // Total cargo cost to insure
    'arrival_service'                 => [
        'enabled'                     => '1', // Enable additional service on arrival        
        'arrival_service.floor'       => '10', // Floor to deliver
        'arrival_service.distance'    => '10', // Distance in Meters to deliver
        'arrival_service.elevator'    => '1', // Boolean, if there is an elevator
    ],
    'derival_service'                 => [    
        'enabled'                     => '0', // Enable additional service on derival
        'floor'                       => '10', // Pickup floor
        'distance'                    => '10', // Pickup Distance in Meters
        'elevator'                    => '1', // Boolean, if there is an elevator
    ]
    /* --- */
    'cargo'                           => [ // It's an array of arrays with cargo data
      [
          'width'                     => '1', // Width in Meters
          'height'                    => '1', // Height in Meters
          'weight'                    => '1', // Weight in KG
          'volume'                    => '1', // Weight in M3
          'max_size'                  => '1', // Max dimension size in Meters
          /* Next fileds are not required */
          'protective_package'        => '1', // Boolean, if you need a protective package
          'total_sealing_positions'   => '4', // Total sealing positions
          'oversized'                 => '1', // Boolean, if cargo is oversized
          /* --- */
      ]
    ]
])

Use Case #2

There are some predefined routes, that will be merged with your routes as well. You may check it by using

php artisan routes:list

It actually exposes the same methods to the routes, so it should be pretty clear on how to use it. For more information on how to use it, please check out src/ folder.


All versions of laravel-pecom with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.40.0 || ^9.0.0 || ^10.0.0
guzzlehttp/guzzle Version ^7.0
bensampo/laravel-enum Version >=3.0 <=6.0
spatie/data-transfer-object Version ^3.7
ext-soap Version *
ext-json Version *
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 sergeevpasha/laravel-pecom contains the following files

Loading the files please wait ....