Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 218e0cc

Browse files
committed
Fix merge issue
2 parents 4dba3fa + 260bd5a commit 218e0cc

17 files changed

+329
-269
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
name: Check & fix styling
1+
name: Fix PHP code style issues
22

3-
on: [ push ]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
47

58
jobs:
6-
php-cs-fixer:
9+
php-code-styling:
710
runs-on: ubuntu-latest
811

912
steps:
10-
- name: Checkout code
11-
uses: actions/checkout@v2
12-
with:
13-
ref: ${{ github.head_ref }}
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.head_ref }}
1417

15-
- name: Run PHP CS Fixer
16-
uses: docker://oskarstark/php-cs-fixer-ga
17-
with:
18-
args: --config=.php_cs.dist.php --allow-risky=yes
18+
- name: Fix PHP code style issues
19+
uses: aglipanci/laravel-pint-action@1.0.0
1920

20-
- name: Commit changes
21-
uses: stefanzweifel/git-auto-commit-action@v4
22-
with:
23-
commit_message: Fix styling
21+
- name: Commit changes
22+
uses: stefanzweifel/git-auto-commit-action@v4
23+
with:
24+
commit_message: Fix styling

.github/workflows/phpstan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: phpstan
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
@@ -23,4 +23,4 @@ jobs:
2323
uses: ramsey/composer-install@v1
2424

2525
- name: Run PHPStan
26-
run: ./vendor/bin/phpstan --error-format=github
26+
run: ./vendor/bin/phpstan --error-format=github

.php_cs.dist.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Laravel ActiveCampaign (WIP)
1+
# Laravel ActiveCampaign
22

33
[![Latest Stable Version](https://poser.pugx.org/label84/laravel-active-campaign/v/stable?style=flat-square)](https://packagist.org/packages/label84/laravel-active-campaign)
44
[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
@@ -10,7 +10,6 @@ This package provides a simple interface to the ActiveCampaign API v3.
1010
Currently the packages only supports the endpoints `Contacts`, `Custom Fields Values` and `Tags`. Feel free to PR the remaining endpoints.
1111

1212
- [Requirements](#requirements)
13-
- [Laravel support](#laravel-support)
1413
- [Installation](#installation)
1514
- [Usage](#usage)
1615
- [Contacts](#contacts)
@@ -99,6 +98,22 @@ use Label84\ActiveCampaign\ActiveCampaign;
9998
resolve(ActiveCampaign::class)->contacts()->delete(1);
10099
```
101100

101+
#### Add a tag to contact
102+
103+
```php
104+
use Label84\ActiveCampaign\ActiveCampaign;
105+
106+
resolve(ActiveCampaign::class)->contacts()->tag(1, 20);
107+
```
108+
109+
#### Remove a tag from a contact
110+
111+
```php
112+
use Label84\ActiveCampaign\ActiveCampaign;
113+
114+
resolve(ActiveCampaign::class)->contacts()->untag(2340);
115+
```
116+
102117
### Custom Field Values
103118

104119
#### Retreive an existing field value by their id

composer.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,32 @@
1313
"php": "^8.0.2",
1414
"illuminate/support": "^9.0|^10.0"
1515
},
16+
"require-dev": {
17+
"laravel/pint": "^1.0",
18+
"orchestra/testbench": "^7.0|^8.0",
19+
"nunomaduro/larastan": "^2.0",
20+
"phpunit/phpunit": "^9.5"
21+
},
1622
"autoload": {
1723
"psr-4": {
1824
"Label84\\ActiveCampaign\\": "src"
1925
}
2026
},
27+
"scripts": {
28+
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
29+
"analyse": "vendor/bin/phpstan analyse",
30+
"format": "vendor/bin/pint"
31+
},
2132
"extra": {
2233
"laravel": {
2334
"providers": [
2435
"Label84\\ActiveCampaign\\ActiveCampaignServiceProvider"
2536
],
2637
"aliases": {
27-
"StatsHelper": "Label84\\ActiveCampaign\\Facades\\ActiveCampaign"
38+
"ActiveCampaign": "Label84\\ActiveCampaign\\Facades\\ActiveCampaign"
2839
}
2940
}
3041
},
31-
"require-dev": {
32-
"orchestra/testbench": "^7.0|^8.0",
33-
"nunomaduro/larastan": "^2.0",
34-
"phpunit/phpunit": "^9.5"
35-
},
3642
"minimum-stability": "dev",
3743
"prefer-stable": true
3844
}

config/active-campaign.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
/**
66
* Your Active Campaign Base URL
77
* https://<your-account>.api-us1.com/api/3
8-
*
8+
*
99
* More information: https://developers.activecampaign.com/reference/url
1010
*/
1111
'base_url' => env('ACTIVE_CAMPAIGN_BASE_URL'),
1212

1313
/**
1414
* Your Active Campaign API key
15-
*
16-
* Your API key can be found in your account on the Settings page under the "Developer" tab.
15+
*
16+
* Your API key can be found in your account on the Settings page under the "Developer" tab.
1717
* Each user in your ActiveCampaign account has their own unique API key.
1818
*/
1919
'api_key' => env('ACTIVE_CAMPAIGN_API_KEY'),

src/ActiveCampaign.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
namespace Label84\ActiveCampaign;
44

5+
use Illuminate\Http\Client\PendingRequest;
6+
use Label84\ActiveCampaign\Resources\ActiveCampaignContactsResource;
7+
use Label84\ActiveCampaign\Resources\ActiveCampaignFieldValuesResource;
8+
use Label84\ActiveCampaign\Resources\ActiveCampaignTagsResource;
9+
10+
/**
11+
* @method PendingRequest makeRequest()
12+
* @method ActiveCampaignContactsResource contacts()
13+
* @method ActiveCampaignFieldValuesResource fieldValues()
14+
* @method ActiveCampaignTagsResource tags()
15+
*/
516
class ActiveCampaign
617
{
718
//

src/ActiveCampaignService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
class ActiveCampaignService
1212
{
1313
public function __construct(
14-
public readonly string $baseUrl,
15-
public readonly string $key,
16-
public readonly int $timeout,
17-
public readonly int|null $retryTimes = null,
18-
public readonly int|null $retrySleep = null,
14+
public string $baseUrl,
15+
public string $key,
16+
public int $timeout,
17+
public int|null $retryTimes = null,
18+
public int|null $retrySleep = null,
1919
) {
2020
}
2121

src/ActiveCampaignServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function register(): void
2121

2222
public function boot(): void
2323
{
24-
$configPath = __DIR__ . '/../config/active-campaign.php';
24+
$configPath = __DIR__.'/../config/active-campaign.php';
2525
$this->publishes([$configPath => $this->getConfigPath()], 'config');
2626
}
2727

@@ -38,7 +38,7 @@ protected function getConfigPath(): string
3838
/**
3939
* Publish the config file
4040
*
41-
* @param string $configPath
41+
* @param string $configPath
4242
*/
4343
protected function publishConfig($configPath): void
4444
{

src/Facades/ActiveCampaign.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22

33
namespace Label84\ActiveCampaign\Facades;
44

5+
use Illuminate\Http\Client\PendingRequest;
56
use Illuminate\Support\Facades\Facade;
7+
use Label84\ActiveCampaign\Resources\ActiveCampaignContactsResource;
8+
use Label84\ActiveCampaign\Resources\ActiveCampaignFieldValuesResource;
9+
use Label84\ActiveCampaign\Resources\ActiveCampaignTagsResource;
610

11+
/**
12+
* @method PendingRequest makeRequest()
13+
* @method ActiveCampaignContactsResource contacts()
14+
* @method ActiveCampaignFieldValuesResource fieldValues()
15+
* @method ActiveCampaignTagsResource tags()
16+
*/
717
class ActiveCampaign extends Facade
818
{
919
protected static function getFacadeAccessor(): string
1020
{
11-
return 'active-campaign';
21+
return \Label84\ActiveCampaign\ActiveCampaign::class;
1222
}
1323
}

0 commit comments

Comments
 (0)