PHPackages                             vanthao03596/laravel-ghtk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vanthao03596/laravel-ghtk

ActiveLibrary

vanthao03596/laravel-ghtk
=========================

This is my package LaravelGhtk

0.0.1(4y ago)231MITPHPPHP ^7.3|^8.0

Since Jul 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/vanthao03596/laravel-ghtk)[ Packagist](https://packagist.org/packages/vanthao03596/laravel-ghtk)[ Docs](https://github.com/vanthao03596/laravel-ghtk)[ GitHub Sponsors](https://github.com/vanthao03596)[ RSS](/packages/vanthao03596-laravel-ghtk/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Laravel GHTK
============

[](#laravel-ghtk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b699c1cdccb8d1714005761f8daa380ba7a3b0d75e9dfa9b5e11303a65ad1072/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616e7468616f30333539362f6c61726176656c2d6768746b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vanthao03596/laravel-ghtk)[![GitHub Tests Action Status](https://camo.githubusercontent.com/31e53ecfe859630139fe3eb01afa9c66c04893897e3437ccb73acd4e19fc64ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f76616e7468616f30333539362f6c61726176656c2d6768746b2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/vanthao03596/laravel-ghtk/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/29f4079cce17d82dc7926fe700e1fe2bb982c804052a5956e24d46ad257d07dd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f76616e7468616f30333539362f6c61726176656c2d6768746b2f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/vanthao03596/laravel-ghtk/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/99720bcf3536b17cd7ee065c24ae20a449880373a2c2c0ea71336064af1b32fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e7468616f30333539362f6c61726176656c2d6768746b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vanthao03596/laravel-ghtk)

To get the latest version, simply require the project using [Composer](https://getcomposer.org). You will need to install any packages that "provide" `psr/http-client-implementation` and `psr/http-factory-implementation`. Most users will want:

For example, to use Guzzle 7:

```
$ composer require "vanthao03596/laravel-ghtk" "guzzlehttp/guzzle:^7.2" "http-interop/http-factory-guzzle:^1.1.0"
```

Once installed, if you are not using automatic package discovery, then you need to register the `Vanthao03596\LaravelGhtk\GhtkServiceProvider` service provider in your `config/app.php`.

You can also optionally alias our facade:

```
        'Ghtk' => Vanthao03596\LaravelGhtk\Facades\Ghtk::class,
```

Configuration
-------------

[](#configuration)

Laravel GHTK requires connection configuration.

To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/ghtk.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

There are two config options:

##### Default Connection Name

[](#default-connection-name)

This option (`'default'`) is where you may specify which of the connections below you wish to use as your default connection for all work. Of course, you may use many connections at once using the manager class. The default value for this setting is `'main'`.

##### Ghtk Connections

[](#ghtk-connections)

This option (`'connections'`) is where each of the connections are setup for your application. Example configuration has been included, but you may add as many connections as you would like.

Usage
-----

[](#usage)

##### GhtkManager

[](#ghtkmanager)

This is the class of most interest. It is bound to the ioc container as `'ghtk'` and can be accessed using the `Facades\Ghtk` facade. This class implements the `ManagerInterface` by extending `AbstractManager`. The interface and abstract class are both part of my [Laravel Manager](https://github.com/GrahamCampbell/Laravel-Manager) package, so you may want to go and checkout the docs for how to use the manager class over at [that repo](https://github.com/GrahamCampbell/Laravel-Manager#usage). Note that the connection class returned will always be an instance of `Vanthao03596\GhtkSdk\Client`.

##### Facades\\Ghtk

[](#facadesghtk)

This facade will dynamically pass static method calls to the `'ghtk'` object in the ioc container which by default is the `GhtkManager` class.

##### GhtkServiceProvider

[](#ghtkserviceprovider)

This class contains no public methods of interest. This class should be added to the providers array in `config/app.php`. This class will setup ioc bindings.

##### Real Examples

[](#real-examples)

Here you can see an example of just how simple this package is to use. Out of the box, the default adapter is `main`. After you enter your authentication details in the config file, it will just work:

```
use Vanthao03596\LaravelGhtk\Facades\Ghtk;
// you can alias this in config/app.php if you like

Ghtk::shipment()
    ->calculateFee([
        'pick_province' => 'Hà Nội',
        'pick_district' => 'Quận Hai Bà Trưng',
        'province' => 'Hà nội',
        'district' => 'Quận Cầu Giấy',
        'address' => 'P.503 tòa nhà Auu Việt, số 1 Lê Đức Thọ',
        'weight' => 1000,
        'value' => 3000000,
        'transport' => 'fly',
        'deliver_option' => 'xteam',
        'tags'  => [1]
    ]);
// we're done here - how easy was that, it just works!

Ghtk::order()->createOrder([
    'products' => [
        [
            'name' => 'bút',
            'weight' => 0.1,
            'quantity' => 1,
            'product_code' => '23304A3MHLMVMXX625'
        ],
        [
            'name' => 'tẩy',
            'weight' => 0.2,
            'quantity' => 1,
            'product_code' => ''
        ]
    ],
    'order' => [
        'id' => 'a9',
        'pick_name' => 'HCM-nội thành',
        'pick_address' => '590 CMT8 P.11',
        'pick_province' => 'TP. Hồ Chí Minh',
        'pick_district' => 'Quận 3',
        'pick_ward' => 'Phường 1',
        'pick_tel' => '0911222333',
        'tel' => '0911222333',
        'name' => 'GHTK - HCM - Noi Thanh',
        'address' => '123 nguyễn chí thanh',
        'province' => 'TP. Hồ Chí Minh',
        'district' => 'Quận 1',
        'ward' => 'Phường Bến Nghé',
        'hamlet' => 'Khác',
        'is_freeship' => 1,
        'pick_date' => '2016-09-30',
        'pick_money' => 47000,
        'note' => 'Khối lượng tính cước tối đa: 1.00 kg',
        'value' => 3000000,
        'transport' => 'fly',
        'pick_option' =>'cod',
        'deliver_option' => 'xteam',
        'pick_session' => '2',
        'tags' => [ 1],
        'email' => 'thao@123.com',
        'use_return_address' => 1
    ]
]);
// this example is simple, and there are far more methods available
```

The ghtk manager will behave like it is a `Vanthao03596\GhtkSdk\Client` class. If you want to call specific connections, you can do with the `connection` method:

```
use Vanthao03596\LaravelGhtk\Facades\Ghtk;

// select the your_connection_name connection, then get going
Ghtk::connection('your_connection_name')shipment()
    ->calculateFee([
        'pick_province' => 'Hà Nội',
        'pick_district' => 'Quận Hai Bà Trưng',
        'province' => 'Hà nội',
        'district' => 'Quận Cầu Giấy',
        'address' => 'P.503 tòa nhà Auu Việt, số 1 Lê Đức Thọ',
        'weight' => 1000,
        'value' => 3000000,
        'transport' => 'fly',
        'deliver_option' => 'xteam',
        'tags'  => [1]
    ]);
```

With that in mind, note that:

```
use Vanthao03596\LaravelGhtk\Facades\Ghtk;

// writing this:
Ghtk::connection('main')->order()->checkStatus('S1.A1.17373471');

// is identical to writing this:
Ghtk::order()->checkStatus('S1.A1.17373471');

// and is also identical to writing this:
Ghtk::connection()->order()->checkStatus('S1.A1.17373471');

// this is because the main connection is configured to be the default
Ghtk::getDefaultConnection(); // this will return main

// we can change the default connection
Ghtk::setDefaultConnection('alternative'); // the default is now alternative
```

If you prefer to use dependency injection over facades like me, then you can easily inject the manager like so:

```
use Vanthao03596\LaravelGhtk\GhtkManager;
use Illuminate\Support\Facades\App; // you probably have this aliased already

class Foo
{
    protected $ghtk;

    public function __construct(GhtkManager $ghtk)
    {
        $this->ghtk = $ghtk;
    }

    public function bar()
    {
        $this->ghtk->order()->checkStatus('S1.A1.17373471');
    }
}

App::make('Foo')->bar();
```

For more information on how to use the `Vanthao03596\GhtkSdk\Client` class we are calling behind the scenes here, check out the docs at , and the manager class at .

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [phamthao](https://github.com/vanthao03596)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1758d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34786441?v=4)[Pham Thao](/maintainers/vanthao03596)[@vanthao03596](https://github.com/vanthao03596)

---

Top Contributors

[![vanthao03596](https://avatars.githubusercontent.com/u/34786441?v=4)](https://github.com/vanthao03596 "vanthao03596 (16 commits)")

---

Tags

laravelvanthao03596laravel-ghtk

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vanthao03596-laravel-ghtk/health.svg)

```
[![Health](https://phpackages.com/badges/vanthao03596-laravel-ghtk/health.svg)](https://phpackages.com/packages/vanthao03596-laravel-ghtk)
```

###  Alternatives

[vinkla/hashids

A Hashids bridge for Laravel

2.1k13.3M73](/packages/vinkla-hashids)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
