Download the PHP package fintech-systems/whmcs-php-api without Composer

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

WHMCS API

GitHub release (latest by date) Tests GitHub Downloads

A testable WHMCS API designed to run standalone or as part of a Laravel Application

Requirements:

Installation

Publish the configuration file:

Configuration Settings whmcs.php

WHMCS_URL should be without the trialing slash.

WHMCS Setup

Allow the IP address of the system connecting to WHMCS:

Create API permissions:

Example API permissions required:

Example, creating a new client with custom fields:

Custom API calls

WHMCS removed the ability to add custom API calls, but there is a hack to get it working again.

An example of a custom API call would be to get a client by their phone number. Let's call this getclientbyphonenumber. At least two steps are required.

  1. Create a custom API call
  2. Inject the permission into the database

Example custom API call

Save the example code below here: includes/api/getclientbyphoneumber.php

Next to use the custom API call getclientbyphonenumber you need to manually update tblapi_roles and add it there.

Also remember to update it every time again you make a changes in the UI because the UI will overwrite the custom API call.

In the example below, the JSON in the database has been updated to include the new API call getclientbyphonenumber.

If you haven't added the PHP file yet, you'll get API Function Not Found.

Examples

Framework Agnostic PHP

Laravel

Publish the configuration file:

php artisan vendor:publish --tag=whmcs-config

Changelog

See CHANGELOG for more information on what has changed recently.

Features

Set Server

Provides the ability to connect to a secondary WHMCS server away from the Facade initiation

Change Package

Change Package

Framework Agnostic PHP:

Laravel App:

Change server

Since we're using a Facade instantiated when it's called, we need some other way to call the constructor when we're connecting to another server.

Result:

A new package is applied to the service. If the package is linked to an API, the API will be called.

Testing

Before testing, please ensure you have copied over the .env.example file to .env as the tests use dotenv.

Debugging

Set WHMCS_DEBUG=true in your .env file to enable debugging. This will output to Spatie Ray if it's installed.

Running the tests

./vendor/bin/pest

To test custom API actions, use a script such as the following:

sh .scp updateclientaddon.php;./vendor/bin/pest

The .scp file should have a copy command, e.g.:

No errors on API actions but not working

API actions are difficult to troubleshoot if you don't observe the server log file. Only some exceptions, e.g., model problems will be caught by the Try Catch block. So help tail your server log file. For example, if you're using Laravel's Valet's Nginx server, do this:

tail -f ~/.valet/Log/nginx-error.log

Invalid IP 127.0.0.1

If you get Invalid IP 127.0.0.1 that means you haven't allowed WHMCS API access from localhost.

Navigate here: https://whmcs.test/admin/configgeneral.php and make sure you add 127.0.0.1 to API IP Access Restriction.

Invalid or missing credentials

If you get Invalid or missing credentials that means you haven't added API roles and API credentials. Both are required before you can test. Also be sure to add them to your .env file:

Invalid Permissions: API action "addclient" is not allowed

If you get Invalid Permissions: API action "addclient" is not allowed that means, although you've added API roles and credentials, your roles are not set up properly for the API call. Revisit roles and the requisite subsection and see where you have to click the checkbox to allow this API call.

Storage folder examples

The storage folder has examples API responses, also used for caching during tests.

Local Editing

For local editing, add this to composer.json:

Then in require section:

Then do this to symlink:

License

MIT

Author

hello (at) eugenefvdm.com
https://eugenefvdm.com
+27 82 309–6710
I am a Laravel, hosting, and WHMCS specialist. Contact me any time for assistance.


All versions of whmcs-php-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/ray Version ^1.41
symfony/dotenv Version ^7.1
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 fintech-systems/whmcs-php-api contains the following files

Loading the files please wait ....