Download the PHP package paubox/paubox-php without Composer

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

Paubox

Paubox PHP

NEW: Version 2 of the Paubox Email API SDK for PHP is available to beta test now. It includes code for newer features like bulk message sending, dynamic templates, and more. We will be deprecating the old in the near future.

This is the official PHP wrapper for the Paubox Email API.

The Paubox Email API allows your application to send secure, HIPAA compliant email via Paubox and track deliveries and opens. The API wrapper also allows you to construct and send messages.

Table of Contents

Installation

Using composer:

Getting Paubox API Credentials

You will need to have a Paubox account. You can sign up here.

Once you have an account, follow the instructions on the Rest API dashboard to verify domain ownership and generate API credentials.

Configuring API Credentials

Include your API credentials in your environment file.

Usage

To send email, prepare a Message object and call the sendMessage method of Paubox.

Sending messages

Allowing non-TLS message delivery

If you want to send non-PHI mail that does not need to be HIPAA-compliant, you can allow the message delivery to take place even if a TLS connection is unavailable.

This means the message will not be converted into a secure portal message when a non-TLS connection is encountered. To allow a non-TLS message delivery, call the setAllowNonTLS(true) method on the message object.

Forcing Secure Notifications

Paubox Secure Notifications allow an extra layer of security, especially when coupled with an organization's requirement for message recipients to use 2-factor authentication to read messages (this setting is available to org administrators in the Paubox Admin Panel).

Instead of receiving an email with the message contents, the recipient will receive a notification email that they have a new message in Paubox.

Adding Attachments and Additional Headers

Checking Email Dispositions

The SOURCE_TRACKING_ID of a message is returned in the response of the sendMessage method. To check the status for any email, use its source tracking id and call the getEmailDisposition method of Paubox:

Paubox Forms

PauboxForms provides access to the Paubox Forms API. The public endpoints — getting a form definition and submitting a form response — are unauthenticated and need no credentials. The form-management endpoints (listing, creating, updating, archiving, and copying forms, plus retrieving submissions, stats, CSVs, and PDFs) require a scoped API key — see Scoped API keys below.

Getting a form

Retrieve the full definition of a form (HTML, JSON schema, CSS, and metadata) by its UUID.

Submitting a form

Build a FormSubmission with form_data matching the form's field schema and call submitForm. Returns true on success; throws an exception on failure.

Submitting a form with file attachments

Attachments must be base64-encoded. Maximum total request size is 250 MB.

Scoped API keys

All of the form-management methods below require a Paubox scoped API key with the forms scope. Generate one from your Paubox dashboard, then either pass it to the PauboxForms constructor or set it in the PAUBOX_FORMS_API_KEY environment variable. The SDK sends it as an Authorization: Bearer header.

Important: PAUBOX_FORMS_API_KEY is a different credential from the transactional Email API key (PAUBOX_API_KEY). Do not reuse the same value for both — although both are sent as Authorization: Bearer headers to the same host, they are scoped to different APIs: the email client sends PAUBOX_API_KEY to https://api.paubox.com/v1/email, while PauboxForms sends PAUBOX_FORMS_API_KEY to https://api.paubox.com/v1/forms. Mixing them misdelivers a credential to the wrong endpoint. Configure both independently:

Optionally, override the target endpoint with a constructor argument or the PAUBOX_FORMS_BASE_URL environment variable. Defaults to https://api.paubox.com/v1/forms:

If no key is configured, calling a management method throws a Paubox\Forms\PauboxFormsException. The public getForm and submitForm methods never require a key.

Error handling

All Forms methods throw Paubox\Forms\PauboxFormsException on failure. The exception's message contains the operation and HTTP status only — the raw response body is not included in the message (form submission bodies can contain PHI). Read getStatusCode(), getUrl(), and getResponseBody() explicitly if you need the details:

Requirements

Getting a form by ID

Retrieve a form through the authenticated management endpoint. Unlike the public getForm, this also returns inactive and archived forms.

Listing forms

List your forms with optional filtering, searching, ordering, and pagination. Include customer_id (your Paubox customer ID) — the API rejects list requests that don't name the customer the key belongs to. Booleans are handled for you — pass real true/false values.

Creating a form

Build a Forms\Form and call createForm. title, formJson, and customerId are required; the other setters are optional. Returns the new form's UUID.

Updating a form

Partial update — pass an associative array with only the attributes you want to change. Allowed keys: title, description, form_json, vanity_url, recipient, active, subscription_list_id. Omitted keys are left unchanged.

Archiving and unarchiving a form

Both return true on success and throw an exception on failure.

Copying a form

Duplicate an existing form under a new title. Returns the full new form object.

Form statistics

Get aggregate stats for your forms. customer_id is optional and defaults to the customer associated with your API key.

Listing submissions

List the submissions for a form with optional ordering and pagination.

Downloading submissions as CSV

getSubmissionsCsv returns every submission for a form as a CSV string; getSubmissionCsv returns a single submission. Save the result to a file or process it directly.

Downloading a submission as PDF

Returns the PDF as a binary string — write it straight to a file.

Webhooks

A webhook endpoint is a URL you own that Paubox notifies when something happens. PauboxWebhooks manages those subscriptions: which URL to notify, and for which events.

Construct it with a scoped API key, sent as Authorization: Bearer <key>. The key can also come from the PAUBOX_WEBHOOKS_API_KEY environment variable:

Which events a key may subscribe to follows from its scopes. The SDK does not inspect them — the service refuses an event the key isn't scoped for with 403, and an unrecognised event with 422.

Available events

Event Fires when
forms.submission.created A form submission is received
api_mail_log_delivered An Email API message is delivered
api_mail_log_opened A delivered message is opened
api_mail_log_temporary_failure Delivery fails temporarily
api_mail_log_permanent_failure Delivery fails permanently
email.inbound.received Inbound mail is received

The four Email API events keep their legacy api_mail_log_ names, so a receiver written against the old Email API webhooks keeps working unchanged. Note these are the names on the wire: delivered or failed on their own are rejected as unknown.

The SDK does not check these names. The catalog lives in the service, so an event added later works here without upgrading the SDK.

Creating a webhook endpoint

signing_secret is returned once, here. It is not on getWebhookEndpoint or listWebhookEndpoints, and there is no way to read it back — recovering from a lost secret means deleting the endpoint and creating a new one. Use it to verify that deliveries really came from Paubox.

Listing webhook endpoints

Pass page and items to paginate:

Getting a webhook endpoint

Updating a webhook endpoint

Only the keys you pass are sent, so changing the status leaves the URL and events alone:

Pausing deliveries without losing the subscription is what disabled is for; set active to resume. Passing events replaces the list rather than adding to it.

Deleting a webhook endpoint

Returns true — the service answers 204 No Content. Deleting stops every event on that endpoint, and the signing secret goes with it.

Webhook error handling

A non-2xx response throws Paubox\Webhooks\PauboxWebhooksException. The service's own message is promoted onto the exception message, since a bare status says nothing about which field was wrong; the raw body is on getResponseBody():

Two cases worth handling explicitly: subscribing a target_url that already has an endpoint comes back as 422, and an id that doesn't belong to your account is a 404 rather than a 403. An id that isn't a UUID is rejected locally, before any request is made.

Running the tests

The default test suite is offline and read-only. Requires no credentials, no fixtures, no network:

Tests that hit the network or write to a real customer account are separated into groups and excluded by default:

To run them:

:warning: The mutating group writes to whatever host PAUBOX_FORMS_BASE_URL points at (defaults to production). Every test attempts to restore state in a finally block, but a crash between an archive and a restore leaves the form archived — verify the test customer is a QA account before running.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/paubox/paubox-php.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright

Copyright © 2021, Paubox, Inc.

💬 Community & support

Questions, ideas, or want to share what you built? Join the Paubox Community — the single home for discussions across every Paubox SDK and API.

🔐 Found a security issue? Email [email protected] — please don't post it publicly.


All versions of paubox-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
nategood/httpful Version ^1.0
vlucas/phpdotenv Version ^5.6
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 paubox/paubox-php contains the following files

Loading the files please wait ...