Giter VIP home page Giter VIP logo

laravel-whmcs's Introduction

WHMCS API for Laravel

Latest Stable Version Total Downloads License

An interface for interaction with the WHMCS API in Laravel. This Package is heavily inspired by Laravel GitLab created by Graham Campbell.

Notice:

The legacy version 0.3 can be found here

Installation

WHMCS API for Laravel requires PHP ^7.4 | ^8.0 with at least Laravel 8.

Install the package through Composer. Run the Composer require command from the Terminal:

composer require darthsoup/laravel-whmcs

Package will be installed automatically through composer package discovery. If not, then you need to register the DarthSoup\Whmcs\WhmcsService service provider in your config/app.php.

Optionally, you can add the alias if you prefer to use the Facade:

'Whmcs' => DarthSoup\Whmcs\Facades\Whmcs::class

Configuration

To get started, you'll need to publish vendor assets for Laravel-Whmcs.

php artisan vendor:publish --provider="DarthSoup\Whmcs\WhmcsServiceProvider"

This will create the config/whmcs.php file in your app, modify it to set your configuration.

Default Connection

The option default is where you specify the default connection.

WHMCS Connections

The option connections is where you can add multiple connections to your whmcs instances. You can choose between both API connection types from whmcs. These methods are password and token. Example connections has been included, but you can add as many connections you would like.

Usage

via dependency injection

If you prefer to use Dependency Injection, you can easily add it to your controller as below:

use DarthSoup\Whmcs\WhmcsManager;

class WhmcsController extends Controller
{
    private WhmcsManager $whmcsManager;

    public function __construct(WhmcsManager $whmcsManager)
    {
        $this->whmcsManager = $whmcsManager;
    }

    public function index()
    {
        $result = $this->whmcsManager->client()->getClients();
        dd($result);
    }
}

Via Facade

If you prefer the classic Laravel facade style, this might be the way to go:

use \DarthSoup\Whmcs\Facades\Whmcs;
# or
use \Whmcs;

\Whmcs::Client()->getClientsDomains(['clientid' => '1']);

Real examples

use \DarthSoup\Whmcs\Facades\Whmcs;

# Obtaining a list of domains purchased by the customer
\Whmcs::Client()->getClientsDomains(['clientid' => '1']);

# Obtaining a list of products purchased by the customer
\Whmcs::Client()->getClientsProducts(['clientid' => '12345']);

# Retrieve a specific invoice
\Whmcs::Billing()->getInvoice(['invoiceid' => '1337']);

# Retrieves all Orders from the system
\Whmcs::Orders()->getOrders();

# Obtain internal users
\Whmcs::Users()->getUsers(['search' => '[email protected]']);

# Custom Method (in case you added custom endpoints) 
\Whmcs::Custom()-><myEndpoint>(['foo' => 'bar']);

For more information on how to use the WhmcsApi Client DarthSoup\WhmcsApi\Client class, check out the documentation at https://github.com/darthsoup/php-whmcs-api.

Support

Please open an issue in github

License

This package is released under the MIT License. See the bundled LICENSE file for details.

laravel-whmcs's People

Contributors

darthsoup avatar dependabot-preview[bot] avatar jakubstephan avatar jobsfav avatar jshah4517 avatar persaeus avatar stephandesouza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-whmcs's Issues

Unable to install package

I installed Laravel fresh today and ran this command to install your package.

composer require darthsoup/laravel-whmcs

Got this error:

PS C:\laragon\www\timesheet> composer require darthsoup/laravel-whmcs
Using version ^0.2.6 for darthsoup/laravel-whmcs
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- Can only install one of: guzzlehttp/guzzle[7.0.1, 6.5.x-dev].
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- darthsoup/laravel-whmcs 0.2.6 requires guzzlehttp/guzzle ~6.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- Installation request for darthsoup/laravel-whmcs ^0.2.6 -> satisfiable by darthsoup/laravel-whmcs[0.2.6].
- Installation request for guzzlehttp/guzzle (locked at 7.0.1, required as ^7.0.1) -> satisfiable by guzzlehttp/guzzle[7.0.1].

Installation failed, reverting ./composer.json to its original content.

What do I do to get past this please?

--
Laravel: 8.1.0
Windows 10
PHP 7.4

Cart alias conflict

Hi I am using the hardevine/LaravelShoppingcart packacge and I think it is conflicting with your package.

I noticed in your composer.json the following line:

"Cart": "DarthSoup\\Whmcs\\Facades\\Whmcs"

Should this not say Whmcs?

No support for Laravel 10

Problem 1
- darthsoup/laravel-whmcs 1.2.0 requires graham-campbell/manager ^4.7 -> satisfiable by graham-campbell/manager[v4.7.0].
- darthsoup/laravel-whmcs[0.1, ..., 0.1.1] require illuminate/support 5.2.|5.3.|5.4.|5.5. -> found illuminate/support[v5.2.0, ..., v5.5.44] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs[0.1.2, ..., 0.2.0] require illuminate/support 5.2.|5.3.|5.4.|5.5.|5.6.* -> found illuminate/support[v5.2.0, ..., v5.6.39] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs[0.2.1, ..., 0.2.2] require illuminate/support 5.2.|5.3.|5.4.|5.5.|5.6.|5.7. -> found illuminate/support[v5.2.0, ..., v5.7.28] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs 0.2.3 requires illuminate/support 5.2.|5.3.|5.4.|5.5.|5.6.|5.7.|5.8.* -> found illuminate/support[v5.2.0, ..., v5.8.36] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs 0.2.4 requires illuminate/support ^5.2|^6.0 -> found illuminate/support[v5.2.0, ..., v5.8.36, v6.0.0, ..., v6.20.44] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs 0.2.5 requires illuminate/support ^5.2|^6.0|^7.0 -> found illuminate/support[v5.2.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs[0.2.6, ..., 0.3.2] require illuminate/support ^5.2|^6|^7|^8 -> found illuminate/support[v5.2.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- darthsoup/laravel-whmcs[1.0.0, ..., 1.1.0] require illuminate/support ^7.0|^8.0|^9.0 -> found illuminate/support[v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.4] but these were not loaded, likely because it conflicts with another require.
- graham-campbell/manager v4.7.0 requires illuminate/contracts ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 -> found illuminate/contracts[v5.5.0, ..., v5.8.36, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.4] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires darthsoup/laravel-whmcs * -> satisfiable by darthsoup/laravel-whmcs[0.1, ..., 0.3.2, 1.0.0, 1.1.0, 1.2.0].

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Please update the dependency for graham-campbell/manager to the latest version 5.0.

Laravel 5.7 support

Hello!

Is it possible to use this package with Laravel 5.7?
If it is, can we please get the new version with the updated requirements?

Thank you! :)

Handle Multiple WHMCS APIs

Hello,
I want to control more than 1 WHMCS Installation using your great package. When I firstly installed the package I saw that you support Dependency Injection, but now it's gone from the documentation. Can you give me an advice how to manage more than 1 WHMCS Installation using API Authentication.

How can I authenticate without config.php

Hi Kevin,

I want to sync several companies with Standalone's Laravel platform where I have all the WHMCS credentials and domain links stored in database when a company is created. I have all the details stored in a database. After switching companies, I get credentials specific to the new company.

The credentials should be obtained from the database and authenticated with your package instead of manually setting them in the whmcs.php config file.

Would it be possible to create a way in this package where the user can get credentials from the database directly and authenticate when he or she calls the API?

Update to Laravel 11

Hello ;)

Could you perform a package update to be up to date with laravel 11 ? :)

Configurable timeout

Guzzle defaults to an indefinite timeout. It would be ideal if the connection to WHMCS had a configurable timeout so prevent scripts running forever.

How to get all the products from whmcs

I am new to laravel 5.6 framework.
Now I am using laravel 5.6 and php version is 7.2.2. I was add this package to my laravel application and configure to use my api url,username and password.But i didn't get any products from WHMCS. I get a blank page.
here attached my code

<?php namespace DarthSoup\Tests\Whmcs; use Whmcs; use DarthSoup\Whmcs\WhmcsServiceProvider; use DarthSoup\Whmcs\tests\WhmcsServiceproviderTest; class ServiceProvider extends TestCase { public function GetProducts() { $data = [ 'action' => 'GetProducts', 'gid' => 1, 'response-type' =>'json', ]; return view ($data); } }

How to add clients in whmcs using controller in laravel 5.6

My laravel controller code is given below:

    `public function insertform(){
     return view('clientlayout.main.signup');
      } 

  public function insert(Request  $request){
    
     $firstname =  $_POST('firstname');
     $lastname =  $_POST('lastname');
     $companyname =  $_POST('companyname');
     $email =  $_POST('email');
    $address1 =  $_POST('address1');
     $address2 =  $_POST('address2');
    $city =  $_POST('city');
     $state =  $_POST('state');
   $postcode =  $_POST('postcode');
    $country =  $_POST('country');
    $phonenumber =  $_POST('phonenumber');
    $password =  $_POST('password');
    $request=array('firstname'=>$firstname,"lastname"=>$lastname,"city"=>$city,"email"=>$email,"country"=>$country,
   "address1"=>$address1,"address2"=>$address2,"state"=>$state,"postcode"=>$postcode,"password"=>$password,
"phonenumber"=>$phonenumber,"companyname"=>$companyname);
 Whmcs::AddClient($request);

Whmcs::create($request->all());
return redirect()->back();
    }

`

The code in the view file is given as follows:

    ` <form class="container" action="{{ route('product.insert') }}" id="needs-validation" 
        method="post" novalidate>

       <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); 
        ?>">
       <div class="row">
       <div class="col-lg-6 col-sm-6 col-12">
       <div class="form-group">
        <label class="text-inverse custom" 
        for="validationCustom01">First Name
        <span class="req">*</span>
        </label>
        <input type="text" name="firstname" class="form-control" 
         id="validationCustom01"  placeholder="First name"
          value="" required maxlength="25" onKeyPress="return ValidateAlpha(event);" 
           style="background-color: rgba(19, 35, 47, 0.4); color:#fff;">
          <div class="invalid-feedback">
           Enter Your Firstname
           </div>
           </div>
           </div>

           </div> 
           </form>`

My Route file code is as follows:

   `Route::get('insert', 'ProductController@insertform');
    Route::post('create', 'ProductController@insert')->name('product.insert');`

Suggest me a solution to post the client details into WHMCS.

cURL error 60: SSL certificate problem: certificate has expired (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://billing.pakchamp.com/includes/api.php

cURL error 60: SSL certificate problem: certificate has expired (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://billing.pakchamp.com/includes/api.php
I am using darthsoup/laravel-whmcs package I set WHMCS_API_URL="https://billing.pakchamp.com/", WHMCS_API_IDENTIFIER, WHMCS_API_SECRET and WHMCS_API_ACCESSKEY but I am getting this above mentioned error can you please suggest where I am wrong.

get whmcs client details in laravel+adminlte

Hi..

I wanted to get all clients detail from whmcs to laravel+ adminlte.
I am new to programming so i need some guide where to put the code so that it appears at admin dashboard.
Here is the code that i found:
<?php $whmcs = app('whmcs'); $whmcs->execute('GetClients', [ 'clientid' => '33' ]);?>

Need you help urgently.
Thank you

Authentication example

Hi sorry for opening an issue but your Discussion tab is not activated.

We have a client who has a wmcs installation and we wanted to use this package to make a better interface for the users.
Do you have any examples on how to authenticate users with Laravel ? With users I mean the clients, not the admin.

Thanks.

It's not a Problem

Hello sir, you help me a lot with this repository i only want to know because when i conect in local machine this work perfectly but when i goes to the plesk server it's show me the error i don't understand why this thinks happen.

I know this is not a Issue but i don't have alternative to contact.
Thank you.

Lumen 5.5 - Facade Issue

I am trying to use this with Lumen 5.5 and not having much luck. I cannot find any documentation for this project for how to configure for Laravel/Lumen.

I added the following to bootstrap/app.php

$app->withFacades(true, ['DarthSoup\Whmcs\Facades\Whmcs' => 'Whmcs']);
$app->register(DarthSoup\Whmcs\WhmcsServiceProvider::class);

What am I doing wrong? Is the above necessary? Any help is appreciated, thank you!

How to insert data client Laravel 8 ?

TypeError
Return value of DarthSoup\WhmcsApi\Api\AbstractApi::DarthSoup\WhmcsApi\Api{closure}() must be of the type bool, string returned

My code like this :

public function store(Request $request)
{
       $result = $this->whmcsManager->client()->addClient([
            'firstname' => $request->input('first_name') ,
            'lastname' => $request->input('last_name'),
            'email' => $request->input('email'),
            'address1' => $request->input('street_address'),
            'city' =>$request->input('city'),
            'state' => $request->input('state'),
            'postcode' => $request->input('postcode'),
            'country' => 'Indonesia',
            'phonenumber' => $request->input('phone'),
            'password2' => $request->input('password'),
            'clientip' => $request->ip(),

        ]);
       dd($result);
}

or I have to make a manual request and models? And how to make error handling when failed submit data client ? Thanks :)

Add Guzzle 7 support

I'm trying to use this package on Laravel 8 upgraded app, and we can't upgrade without also upgrading to Guzzle7 :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.