PHPackages                             kylewlawrence/laravel-mainwp-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kylewlawrence/laravel-mainwp-api

ActiveLibrary[API Development](/categories/api)

kylewlawrence/laravel-mainwp-api
================================

Laravel API for MainWP

3191[1 PRs](https://github.com/KyleWLawrence/laravel-mainwp-api/pulls)PHP

Since Sep 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/KyleWLawrence/laravel-mainwp-api)[ Packagist](https://packagist.org/packages/kylewlawrence/laravel-mainwp-api)[ RSS](/packages/kylewlawrence-laravel-mainwp-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel MainWP
==============

[](#laravel-mainwp)

This package provides integration with the MainWP API. It currently only supports sending a chat message.

Installation
------------

[](#installation)

You can install this package via Composer using:

```
composer require kylewlawrence/laravel-mainwp-api
```

The facade is automatically installed.

```
MainWP::get('sites', ['per_page' => 100]);
```

Configuration
-------------

[](#configuration)

To publish the config file to `app/config/mainwp-laravel.php` run:

```
php artisan vendor:publish --provider="KyleWLawrence\MainWP\Providers\MainWPServiceProvider"
```

Set your configuration using **environment variables**, either in your `.env` file or on your server's control panel:

- `MAINWP_DOMAIN`

The fully qualified domain name where MainWP is hosted.

- `MAINWP_CONSUMER_KEY`

The API access consumer auth. You can create one as described here: `https://kb.mainwp.com/docs/mainwp-rest-api/`

- `MAINWP_CONSUMER_SECRET`

Accompanying the consumer key.

- `MAINWP_DRIVER` *(Optional)*

Set this to `null` or `log` to prevent calling the MainWP API directly from your environment.

Contributing
------------

[](#contributing)

Pull Requests are always welcome here. I'll catch-up and develop the contribution guidelines soon. For the meantime, just open and issue or create a pull request.

Usage
-----

[](#usage)

### Facade

[](#facade)

The `MainWP` facade acts as a wrapper for an instance of the `MainWP\Http\HttpClient` class.

### Dependency injection

[](#dependency-injection)

If you'd prefer not to use the facade, you can instead inject `KyleWLawrence\MainWP\Services\MainWPService` into your class. You can then use all of the same methods on this object as you would on the facade.

```
