Download the PHP package justinholtweb/craft-freshh without Composer

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

Freshh

FreshBooks accounting for Craft Commerce. Orders become invoices, customers become clients, transactions become payments, refunds become credit notes — and FreshBooks tells Craft when an invoice gets paid.

Requires Craft CMS 5.3+, Craft Commerce 5.0+ and PHP 8.2+.


What it does

Craft Commerce → FreshBooks
Completed order → Invoice, marked as sent
Customer (or guest email) → Client
Successful purchase/capture transaction → Payment against the invoice
Refund transaction → Credit note
Purchasable (optional) → Catalogue item
Order status (optional) ← Invoice status

Install

Connect

  1. Create an app at my.freshbooks.com/#/developer.
  2. Copy the redirect URI from Freshh's settings screen into the app. FreshBooks refuses a redirect URI that is not HTTPS or that carries a query string, which is why Freshh uses a plain control-panel path rather than an action URL.
  3. Paste the client ID and secret into Freshh's settings and save.
  4. Press Connect to FreshBooks and approve the connection.

FreshBooks only supports the authorization code grant — there is no machine-to-machine flow — so a human has to approve the connection once. After that Freshh keeps it alive by refreshing.

Preview before you trust it

The settings screen has a Preview the latest order button, and every order has a preview of its own. Both run the same Mapper::build() the queue job runs, so what you are shown is byte-for-byte what FreshBooks will receive — including the running total FreshBooks will arrive at, next to the total the customer actually paid.

That comparison is the point. FreshBooks builds an invoice from qty × unit_cost plus percentage taxes; Commerce stores totals and tax amounts. Freshh does that arithmetic itself before sending, and if the two disagree it either adds a rounding line (when the gap is cents) or refuses to send at all (when it is not). An invoice that is a pound out is worse than no invoice.

How money is mapped

Duplicate invoices, and why you will not get any

FreshBooks accepts no idempotency key, and a queue worker can die between creating an invoice and recording that it did. Freshh therefore never creates blind:

  1. Claim a row in freshh_links, unique on (resourceType, localKey). Two workers cannot both own one order.
  2. Reconcile. A claim that finds a half-finished row asks FreshBooks for the invoice number this order would have used. If it is already there, it is adopted.
  3. Create, then record.

The same pattern protects payments (matched on a marker in the payment note) and credit notes.

Getting state back

FreshBooks callbacks tell Craft when an invoice is viewed, paid or written off. Press Register callbacks on the settings screen; FreshBooks will post a verification code to the site and Freshh completes the handshake automatically.

The endpoint checks the HMAC signature, then throws the payload away and re-fetches the resource from the API. A forged callback costs one wasted API call and cannot change a number in anyone's books.

If FreshBooks cannot reach the site — local development, staging behind basic auth, an intranet — use freshh/sync/pull on a schedule instead.

Console

Templating

Nothing on craft.freshh triggers a sync. A page render is not a place to make an API call.

Extending

Mapper::EVENT_AFTER_BUILD_INVOICE fires once the payload is built and reconciled, before anything is sent — the place to add a PO number, a project id or an extra line:

Because every path goes through the mapper, a handler here reaches the queue job, the console command and the preview alike.

Safety

Licence

The Craft License. One Craft installation per licence — see LICENSE.md.


All versions of craft-freshh with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
craftcms/cms Version ^5.3.0
craftcms/commerce Version ^5.0.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 justinholtweb/craft-freshh contains the following files

Loading the files please wait ...