PHPackages                             gam/estafeta-command - 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. [CLI &amp; Console](/categories/cli)
4. /
5. gam/estafeta-command

ActiveLibrary[CLI &amp; Console](/categories/cli)

gam/estafeta-command
====================

PHP library to run 'estafeta interactive command' web portal operations programmatically.

v1.2.0(3y ago)12.4k↑306.7%Apache-2.0PHPPHP &gt;=8.0

Since Apr 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/gam04/estafeta-command)[ Packagist](https://packagist.org/packages/gam/estafeta-command)[ RSS](/packages/gam-estafeta-command/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (10)Versions (8)Used By (0)

Comando Estafeta
================

[](#comando-estafeta)

[![Total Downloads](https://camo.githubusercontent.com/56ff3e7c80defd4bab9f906acb99e9d0ea0ba9512039140ef3aeb32854290077/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67616d2f65737461666574612d636f6d6d616e642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gam/estafeta-command)[![GitHub Workflow Status](https://camo.githubusercontent.com/8388e6d5f688acf63dda374791e3ca1e48f282be9bf735572d410b43a2ca2bc8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f67616d30342f65737461666574612d636f6d6d616e642f6275696c643f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/8388e6d5f688acf63dda374791e3ca1e48f282be9bf735572d410b43a2ca2bc8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f67616d30342f65737461666574612d636f6d6d616e642f6275696c643f7374796c653d666c61742d737175617265)[![GitHub](https://camo.githubusercontent.com/e51c0f3b9133d91d9d59460fb4757d388d41aeafadd1a5f8e0ac340f89a512eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f67616d30342f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e51c0f3b9133d91d9d59460fb4757d388d41aeafadd1a5f8e0ac340f89a512eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f67616d30342f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)[![GitHub release (latest by date)](https://camo.githubusercontent.com/8914d90ace780f064ca4b310edf033d1c273eff0870c98bfdf7f708f340d56df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f67616d30342f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/8914d90ace780f064ca4b310edf033d1c273eff0870c98bfdf7f708f340d56df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f67616d30342f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)[![Packagist PHP Version Support](https://camo.githubusercontent.com/cd795285afa763886a784f50fe070ced658bddad06cec7d50c4e747bb833addd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f67616d2f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/cd795285afa763886a784f50fe070ced658bddad06cec7d50c4e747bb833addd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f67616d2f65737461666574612d636f6d6d616e643f7374796c653d666c61742d737175617265)

> PHP library to run 'estafeta interactive command' web portal operations programmatically.

Sponsors
--------

[](#sponsors)

[![EP](https://camo.githubusercontent.com/06a2299dd0e44640c760046f440639cdc533fe76783e917b8c33e106ce2daf0c/68747470733a2f2f656e76696f73706572726f732e636f6d2f696d672f6c6f676f2f6c6f676f2e737667)](https://enviosperros.com)

Features
--------

[](#features)

- Get Estafeta Account information programmatically:
    - Available services
    - Available content types
- Find Locations by Postal code.
- Find Suburbs (Colonia) by name.
- Create Labels (Guias).

Installation
------------

[](#installation)

`composer require gam/estafeta-command`

Usage
-----

[](#usage)

This is a simple example:

```
// 1. set your credentials
$credentials = new Credentials('user', 'password');
$command = new Command($credentials);

// 2. fetch your account data
$account = $command->fetchAccount();
$terrestre = $account->getServiceByName(Service::NEXT_DAY);
$caja = $account->getContentTypeByName(ContentType::BOX);

// 3. Find a Suburb by Postal Code & Name
$originSection= $command->fetchSections('97306')
    ->findBySuburb('LOS HEROES', true)
    ->first();

// 4. Create an Origin Address
$originAddress = new Address('Salome', '587');
// 5. Create an Origin Contact
$originContact = new Contact(
    'Foo',
    'Bar',
    new Rfc('Foo Company'),
    'foo@bar.com',
    new ContactPhone('0000000000', '0000000000')
);
// 6. Create the Origin
$origin = new Location(
    '', // not necessary
    $originSection,
    $originAddress,
    LocationCategory::OTHERS(),
    LocationType::ORIGIN(),
    $originContact
);

// 7. Find Destination Section by postal code
$destinationSection = $command->fetchSections('81000')
    ->findBySuburb('CENTRO', true)
    ->first();

// 8. Create Destination Address
$destinationAddress = new Address('Vicente Guerrero', '790', '2');
// 9. Create Destination Contact
$destinationContact = new Contact(
    'Foo',
    'Bar',
    new Rfc('Bar SA')
);
// 10. Create the Destination
$destination = new Location(
    '', // not necessary
    $destinationSection,
    $destinationAddress,
    LocationCategory::OTHERS(),
    LocationType::DESTINATION(),
    $destinationContact
);
// 11. Set Print Config
$pringConfig = new PrintConfig(PrintType::LOCAL(), PaperType::BOND());

// 12. Build the Label.
$labelParameters = (new \Gam\Estafeta\Command\LabelParametersBuilder())
    ->withAccount($account)
    ->withService($terrestre)
    ->withContentType($caja)
    ->withPackage(new Package(
        14.0,
        new \Gam\Estafeta\Command\Model\Dimension(57, 57, 21),
        'Vasos termicos'
    ))
    ->withPackagingType(PackagingType::PACKAGE())
    ->withOrigin($origin)
    ->withDestination($destination)
    ->withPrintConfig($pringConfig)
    ->build();

$label = $command->createLabel($labelParameters);

// store the label file
file_put_contents("{$label->getId()}.pdf", $label->getPdf());

// finally, close the session
$command->logout();
```

### Model Validation &amp; Cleaner

[](#model-validation--cleaner)

The package has built-in validation according to official web portal rules. The following models are validated in the constructor because their attributes cannot be modified after object construction.

- Address
- Contact
- ContactPhone
- Dimension
- LabelReference
- Package
- Reference
- Rfc

The following models have buil-in cleaner (data sanitization) to remove not allowed characters:

#### Address

[](#address)

- `firstStreet`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.
- `streetAddress`: Diferent characters of `[^a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `apartmentNumber`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.
- `secondStreet`: Diferent characters of `[^a-zÁÉÍÓÚáéíóú \d_]` are removed.

#### Contact

[](#contact)

- `shortName`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.
- `contactName`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.

#### LabelReference

[](#labelreference)

- `contentDescription`: Diferent characters of `[^a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `reference`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.
- `description`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.

#### Package

[](#package)

- `additionalInfo`: Diferent characters of `[a-z ÁÉÍÓÚáéíóú\d.,;:#*^\/]` are removed.
- `costCenter`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.

#### Reference

[](#reference)

- `betweenStreet`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `andStreet`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `shed`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `platform`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.
- `references`: Diferent characters of `[a-zÁÉÍÓÚáéíóú \d_]` are removed.

If you want to disable this sanitization on some models, please set:

```
Reference::disablePrepareData();
```

Also you could add your own sanitization methods:

```
Reference::registerPrepareCallbacks([
    'betweenStreet' => [MyOwnCleaner::class, 'sizeTruncate']
]);
```

See `CleanerTest` for more examples.

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

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

Credits
-------

[](#credits)

- [Gamboa Aguirre](https://github.com/gam04)

Todo
----

[](#todo)

- **Setup a CD workflow**: I need a secret file to run the tests
- **Validate models**: Validate Model properties according to Estafeta Web App Rules.
- **Improve docs**: Maybe ReadTheDocs, using markdown, etc...

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Every ~24 days

Total

6

Last Release

1410d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e9412222c1a56aeeea3408e4ecbc6cf97d5f2c23b16182120f97237efa15e3b?d=identicon)[gam04](/maintainers/gam04)

---

Top Contributors

[![gam04](https://avatars.githubusercontent.com/u/47505661?v=4)](https://github.com/gam04 "gam04 (9 commits)")

---

Tags

guiasestafetacomando

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gam-estafeta-command/health.svg)

```
[![Health](https://phpackages.com/badges/gam-estafeta-command/health.svg)](https://phpackages.com/packages/gam-estafeta-command)
```

###  Alternatives

[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54743.1k4](/packages/jolicode-castor)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10244.2k5](/packages/bitrix24-b24phpsdk)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

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