Download the PHP package jonathan8312/plemsi-laravel without Composer

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

PLEMSI Laravel SDK

A community-maintained Laravel SDK for the public PLEMSI API — Colombian electronic invoicing (facturación electrónica) and related DIAN-regulated documents.

CI Packagist Version

Not an official PLEMSI package. This is an independent, open-source integration built by reading PLEMSI's public Postman collection and verifying real behavior against their staging environment. It is not affiliated with, endorsed by, or supported by PLEMSI.

What this package does

jonathan8312/plemsi-laravel gives your Laravel application a clean, typed, testable way to talk to PLEMSI: issuing electronic invoices, credit and debit notes, support documents, and RADIAN events; managing customers, your company profile, and DIAN numbering resolutions; and looking up DIAN reference catalogs (municipalities, taxes, payment methods, and more).

It is deliberately just an SDK — it does not calculate totals or taxes, does not model your invoices/orders/customers in your database, and does not perform DIAN's own validation on your behalf. Your application owns its domain logic; this package owns talking to PLEMSI correctly and safely.

It is also free, open source, and has no phone-home behavior — no license checks, no telemetry, no tracking, no remote activation. It only ever talks to the PLEMSI base URL you configure.

Requirements

PHP 8.2 or newer
Laravel 12.x or 13.x

This is the exact matrix verified on every change by CI (PHP 8.2/8.4 against Laravel 12, PHP 8.3/8.5 against Laravel 13). No other combination is tested or supported.

Installation

The package registers itself automatically via Laravel package discovery — no manual service provider registration needed.

Optionally publish the config file:

This creates config/plemsi.php. Publishing it is optional — the package ships with sensible defaults for everything except your PLEMSI token and base URL, which you must set yourself.

Configuration

Set these in your application's .env:

Variable Required Default Description
PLEMSI_TOKEN No (none) Default Bearer token, used by every call that doesn't explicitly select a company via withToken(). Leave unset for multi-tenant apps.
PLEMSI_BASE_URL Yes (none) The PLEMSI API base URL. No default is provided on purpose — see Environments.
PLEMSI_CONNECT_TIMEOUT No 5 TCP connection timeout, in seconds.
PLEMSI_TIMEOUT No 15 Total request timeout, in seconds.
PLEMSI_RETRY_ENABLED No false Whether idempotent GET requests may be retried automatically.
PLEMSI_RETRY_MAX_ATTEMPTS No 2 Max attempts (including the first) for a retryable GET request.
PLEMSI_RETRY_BACKOFF_MS No 200 Milliseconds between retry attempts.

PLEMSI_BASE_URL has no built-in default — not even PLEMSI's own staging URL — so a misconfigured deployment fails loudly at boot instead of silently talking to the wrong environment. See Environments and Configuration for the full detail.

Quick start

Every resource is reached through $plemsi->{resource}(), never through a hand-built PLEMSI URL — see each resource's own doc page below for its full request shape, since PLEMSI's payloads are too specific to summarize generically here.

Available resources

Resource Accessor Docs
Catalogs $plemsi->catalogs() docs/catalogs.md
Customers $plemsi->customers() docs/customers.md
Company $plemsi->company() docs/company.md
Invoices $plemsi->invoices() docs/invoices.md
Credit Notes $plemsi->creditNotes() docs/credit-notes.md
Debit Notes $plemsi->debitNotes() docs/debit-notes.md
Resolutions $plemsi->resolutions() docs/resolutions.md
General $plemsi->general() docs/general.md
Support Documents $plemsi->supportDocuments() docs/support-documents.md
RADIAN Events $plemsi->radianEvents() docs/radian-events.md

Two resources not implemented yet: Nota Crédito a Documento Soporte and Docs. Equivalentes / POS. See Known Issues for status.

Methods, resource by resource

Catalogs — $plemsi->catalogs() — read-only DIAN reference lists:

documentIdentificationTypes(), municipalities(), municipalitiesComplete(), countries(), departments(), regimeTypes(), liabilityTypes(), operationTypes(), organizationTypes(), taxes(), unitMeasures(), paymentMethods(), paymentForms(), itemIdentificationTypes(), eventRejectionTypes(), documentTypes(), healthOperationTypes(), healthContractingPaymentMethods(), healthCoverageTypes(), healthPaymentCollectionTypes(). See docs/catalogs.md.

Customers — $plemsi->customers():

Method What it does
create(CustomerData $customer) Register a new customer.
all() List every customer registered for the current company.
find(string $id) Look up a customer by PLEMSI's internal identifier.
dianBasicInfo(int $typeDocumentId, string $identificationNumber) Look up a person/company's basic info directly from DIAN.
filtered(CustomerFilters $filters) Search customers by DNI, name, email, and/or phone.
update(string $id, CustomerData $customer) Partially update an existing customer.

Company — $plemsi->company():

Method What it does
get() Get the current company's profile.
update(CompanyData $company) Partially update the current company's profile.

Invoices — $plemsi->invoices():

Method What it does
create(InvoiceData $invoice) Issue a new electronic sales invoice.
all(?int $limit = null) List invoices for the current company.
find(DocumentLookupField $by, string $value) Find a single invoice by cude, number, or id.
pdf(string $cude) Get the invoice's graphic representation (PDF), base64-encoded.
xml(string $cude) Get the invoice's XML (AttachedDocument), base64-encoded.

Credit Notes — $plemsi->creditNotes():

Method What it does
create(CreditNoteData $creditNote) Issue a new credit note, referencing an invoice or standalone.
all(NoteListOptions $options = new NoteListOptions) List credit notes for the current company.
find(DocumentLookupField $by, string $value) Find a single credit note by cude, number, or id.
xml(string $cude) Get the credit note's XML (AttachedDocument), base64-encoded.

Debit Notes — $plemsi->debitNotes():

Method What it does
create(DebitNoteData $debitNote) Issue a new debit note.
all(NoteListOptions $options = new NoteListOptions) List debit notes for the current company.
find(DocumentLookupField $by, string $value) Find a single debit note by cude, number, or id.
xml(string $cude) Get the debit note's XML (AttachedDocument), base64-encoded.

Resolutions — $plemsi->resolutions():

Method What it does
create(ResolutionData $resolution) Register a new DIAN numbering resolution.
all(ResolutionListOptions $options = new ResolutionListOptions) List the resolutions registered for the current company.
remainingNumbers() Get the remaining folio/consecutive numbers for every registered resolution.
remainingNumbersFor(string $resolution) Get the remaining folio/consecutive numbers for one resolution, by resolution number.

General — $plemsi->general():

Method What it does
resendEmail(string $document, string $targetEmail) Resend the notification email for a previously issued sales document.
some(string $id) Deprecated — confirmed disabled by PLEMSI itself.

Support Documents — $plemsi->supportDocuments():

Method What it does
create(SupportDocumentData $supportDocument) Issue a new support document.
all(SupportDocumentListOptions $options = new SupportDocumentListOptions) List support documents for the current company.
find(DocumentLookupField $by, string $value) Find a single support document by cude, number, or id.

RADIAN Events — $plemsi->radianEvents():

Method What it does
create(RadianEventType $type, RadianEventData $event) Issue a new RADIAN event against a referenced invoice.
all(RadianEventListOptions $options = new RadianEventListOptions) List RADIAN events for the current company.
find(string $id) Find a single RADIAN event by PLEMSI's internal _id.

Every table above is a summary — request shapes, required/optional fields, and real behavior confirmed against staging are documented in full on each resource's own doc page linked above. This README intentionally does not duplicate that detail.

Multi-company / SaaS usage

PLEMSI issues one token per company. For applications serving more than one company, resolve a scoped instance per request instead of relying on the configured default:

withToken() never mutates the instance it's called on — it always returns a new, independent one, which is safe under Octane and other long-running workers. See Authentication.

Why not a Facade?

This package doesn't ship a static Illuminate\Support\Facades\Plemsi facade — you resolve Plemsi::class from the container (or its 'plemsi' alias) directly, as shown throughout this README. Two reasons:

  1. Immutable multi-company scoping. withToken() returns a new instance rather than mutating the shared singleton (see Multi-company / SaaS usage above). A static facade makes it easy to call Plemsi::withToken(...) and assume it changed the app-wide instance, when really the return value is what you needed to keep.
  2. Testability without facade mocking. Everything goes through Illuminate\Http\Client, so Http::fake() already covers testing (see Testing your own application) — there's no need for Plemsi::shouldReceive(...)-style facade mocks, which would encourage mocking the SDK's own methods instead of the actual HTTP boundary.

Full rationale in docs/authentication.md.

Error handling

Every failure is surfaced as one of a small set of typed exceptions, all extending Jonathan8312\Plemsi\Exceptions\PlemsiException:

Exception When
AuthenticationException HTTP 401; PLEMSI's specific invalid-token HTTP 400 body; or no token configured at all.
ValidationException HTTP 422.
ApiException Any other unsuccessful response (403, 404, 429, other 400s, 5xx).
ConnectionException No HTTP response received (DNS/TLS failure, refused connection, timeout).

POST/PUT requests (every document-issuing operation) are never retried automatically, under any configuration — an automatic retry of a non-idempotent call risks creating a duplicate electronic document. See Errors for the full model, including PLEMSI's inconsistent response envelope shapes across endpoints.

Testing your own application

This SDK talks to PLEMSI through Laravel's own HTTP client, so Http::fake() works exactly as it does for any other Laravel HTTP call:

See Testing for asserting on requests and for running this package's own opt-in staging verification suite.

Security

See docs/authentication.md for the full detail. Please report suspected security issues privately to [email protected] rather than opening a public issue.

Known limitations

Some PLEMSI/DIAN behavior is documented in docs/known-issues.md as an environment or upstream limitation rather than an SDK defect — for example, RADIAN event issuance requiring a second, acquirer-side company account to fully verify, and DIAN offering no test environment at all for Documento Soporte. Worth a read before you file an issue against unexpected staging behavior.

Scope

This package is intentionally just an SDK. It does not:

Your application remains responsible for its own domain logic; this package is responsible for communicating correctly and safely with PLEMSI.

Contributing

This package is built module by module, strictly against PLEMSI's documented Postman collection and behavior verified on their staging environment — never invented endpoints, fields, or business rules. If you'd like to contribute, please open an issue first to discuss scope.

Author

Maintained by Jonathan Torres — trebolcolombia.com.

License

MIT — see LICENSE.


All versions of plemsi-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
illuminate/contracts Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
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 jonathan8312/plemsi-laravel contains the following files

Loading the files please wait ...