mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:40:08 +00:00
chore: remove Unifi integration (#2791)
Co-authored-by: Alex Justesen <1144087+alexjustesen@users.noreply.github.com>
This commit is contained in:
@@ -1,152 +0,0 @@
|
||||
---
|
||||
name: saloon-development
|
||||
description: Build and work with SaloonPHP API integrations, including connectors, requests, and responses.
|
||||
---
|
||||
|
||||
# SaloonPHP Development
|
||||
|
||||
## When to use this skill
|
||||
|
||||
Use this skill when working with SaloonPHP features:
|
||||
|
||||
- Creating API integrations or SDKs
|
||||
- Building connectors or requests
|
||||
- Working with authentication, middleware, or responses
|
||||
- Implementing pagination, retries, or rate limiting
|
||||
- Testing API integrations with mocking
|
||||
|
||||
## Documentation
|
||||
|
||||
Use `web-search` for docs at https://docs.saloon.dev. Check `composer.json` for version (v2, v3 or v4).
|
||||
|
||||
## Features
|
||||
|
||||
- **Artisan Commands**: Generate classes with `saloon:connector`, `saloon:request`, `saloon:response`, `saloon:plugin`, `saloon:auth`. Example:
|
||||
|
||||
```bash
|
||||
php artisan saloon:connector GitHub GitHubConnector
|
||||
php artisan saloon:request GitHub GetUserRequest
|
||||
```
|
||||
|
||||
- **Connectors**: Define base URL and shared config. Extend `Saloon\Http\Connector`. Example:
|
||||
|
||||
```php
|
||||
use Saloon\Http\Connector;
|
||||
|
||||
class GitHubConnector extends Connector
|
||||
{
|
||||
public function resolveBaseUrl(): string
|
||||
{
|
||||
return 'https://api.github.com';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **Requests**: Define endpoints. Extend `Saloon\Http\Request`, set `$method` via `Saloon\Enums\Method`. Example:
|
||||
|
||||
```php
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
|
||||
class GetUserRequest extends Request
|
||||
{
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/user';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **Sending Requests**: Use connector to send requests. Example:
|
||||
|
||||
```php
|
||||
$response = $connector->send(new GetUserRequest);
|
||||
$response->json(); // Array
|
||||
$response->successful(); // Bool
|
||||
```
|
||||
|
||||
- **Body Types**: Implement `HasBody` + trait (`HasJsonBody`, `HasFormBody`, `HasMultipartBody`, `HasXmlBody`, `HasStringBody`, `HasStreamBody`).
|
||||
|
||||
- **Authentication**: Use `TokenAuthenticator`, `BasicAuthenticator`, `QueryAuthenticator`, or implement `Saloon\Contracts\Authenticator`.
|
||||
|
||||
- **Plugins**: Built-in traits: `AcceptsJson`, `AlwaysThrowOnErrors`, `HasTimeout`, `HasRetry`, `HasRateLimit`, `WithDebugData`, `CastsToDto`.
|
||||
|
||||
- **Middleware**: Use `middleware()->onRequest()` and `middleware()->onResponse()`, or implement `boot()` method.
|
||||
|
||||
- **DTOs**: Implement `createDtoFromResponse()` in request classes, use `$response->dto()` or `$response->dtoOrFail()`.
|
||||
|
||||
- **Laravel Facade**: Mock requests in tests. Example:
|
||||
|
||||
```php
|
||||
Saloon::fake([GetUserRequest::class => MockResponse::make(['name' => 'Sam'])]);
|
||||
```
|
||||
|
||||
- **HTTP Sender**: Enable Telescope support via `config/saloon.php`:
|
||||
|
||||
```php
|
||||
'default_sender' => \Saloon\Laravel\HttpSender::class,
|
||||
```
|
||||
|
||||
- **v3 Retry**: Set `$tries`, `$retryInterval`, `$useExponentialBackoff` on connectors/requests.
|
||||
|
||||
- **v3 Pagination**: Requires `saloonphp/pagination-plugin`.
|
||||
|
||||
## File Structure
|
||||
|
||||
Store classes in `app/Http/Integrations/{ServiceName}/` (configurable in `config/saloon.php`).
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
- Not using Artisan commands to generate classes
|
||||
- Forgetting `HasBody` interface when sending body data
|
||||
- Wrong HTTP method enum (use `Saloon\Enums\Method`)
|
||||
- Missing `HttpSender` config for Telescope
|
||||
- v3 or v4: forgetting to install pagination plugin
|
||||
|
||||
## Available Documentation
|
||||
|
||||
Use `web-search` with these docs for specific topics:
|
||||
|
||||
## Upgrade
|
||||
|
||||
- [https://docs.saloon.dev/upgrade/upgrading-from-v3-to-v4] Use these docs to understand what's new in SaloonPHP v4
|
||||
- [https://docs.saloon.dev/upgrade/whats-new-in-v3] Use these docs to understand what's new in SaloonPHP v3
|
||||
- [https://docs.saloon.dev/upgrade/upgrading-from-v2] Use these docs for upgrading from SaloonPHP v2 to v3
|
||||
|
||||
## The Basics
|
||||
|
||||
- [https://docs.saloon.dev/the-basics/installation] Use these docs for installation instructions, Composer setup, and initial configuration
|
||||
- [https://docs.saloon.dev/the-basics/connectors] Use these docs for creating connectors, setting base URLs, default headers, and shared configuration
|
||||
- [https://docs.saloon.dev/the-basics/requests] Use these docs for creating requests, defining endpoints, HTTP methods, query parameters, and request bodies
|
||||
- [https://docs.saloon.dev/the-basics/authentication] Use these docs for authentication methods including token, basic, OAuth2, and custom authenticators
|
||||
- [https://docs.saloon.dev/the-basics/request-body-data] Use these docs for sending body data in requests, including JSON, XML, and multipart form data
|
||||
- [https://docs.saloon.dev/the-basics/sending-requests] Use these docs for sending requests through connectors, handling responses, and request lifecycle
|
||||
- [https://docs.saloon.dev/the-basics/responses] Use these docs for handling responses, accessing response data, status codes, and headers
|
||||
- [https://docs.saloon.dev/the-basics/handling-failures] Use these docs for handling failed requests, error responses, and using AlwaysThrowOnErrors trait
|
||||
- [https://docs.saloon.dev/the-basics/debugging] Use these docs for debugging requests and responses, using the debug() method, and inspecting PSR-7 requests
|
||||
- [https://docs.saloon.dev/the-basics/testing] Use these docs for testing Saloon integrations, mocking requests, and writing assertions
|
||||
|
||||
## Digging Deeper
|
||||
|
||||
- [https://docs.saloon.dev/digging-deeper/data-transfer-objects] Use these docs for casting API responses into DTOs, creating DTOs from responses, implementing WithResponse interface, and using DTOs in requests
|
||||
- [https://docs.saloon.dev/digging-deeper/building-sdks] Use these docs for building SDKs with Saloon, creating resource classes, and organizing API integrations
|
||||
- [https://docs.saloon.dev/digging-deeper/solo-requests] Use these docs for creating standalone requests without connectors using SoloRequest class
|
||||
- [https://docs.saloon.dev/digging-deeper/retrying-requests] Use these docs for implementing retry logic with exponential backoff and custom retry strategies (v3 includes global retry system at connector level)
|
||||
- [https://docs.saloon.dev/digging-deeper/delay] Use these docs for adding delays between requests to prevent rate limiting and server overload
|
||||
- [https://docs.saloon.dev/digging-deeper/concurrency-and-pools] Use these docs for sending concurrent requests using pools, managing multiple API calls efficiently, and asynchronous request handling
|
||||
- [https://docs.saloon.dev/digging-deeper/oauth2-authentication] Use these docs for OAuth2 authentication flows including Authorization Code Grant, Client Credentials, and token refresh
|
||||
- [https://docs.saloon.dev/digging-deeper/middleware] Use these docs for creating and using middleware to modify requests and responses, request lifecycle hooks, and boot methods
|
||||
- [https://docs.saloon.dev/digging-deeper/psr-support] Use these docs for PSR-7 and PSR-17 support, accessing PSR requests and responses, and modifying PSR-7 requests
|
||||
|
||||
## Installable Plugins
|
||||
|
||||
- [https://docs.saloon.dev/installable-plugins/pagination] Use these docs for the Pagination plugin to handle paginated API responses with various pagination methods (required in v3, optional in v2)
|
||||
- [https://docs.saloon.dev/installable-plugins/laravel-integration] Use these docs for Laravel plugin features including Artisan commands, facade, events, and HTTP client sender
|
||||
- [https://docs.saloon.dev/installable-plugins/caching-responses] Use these docs for the Caching plugin to cache API responses and improve performance
|
||||
- [https://docs.saloon.dev/installable-plugins/handling-rate-limits] Use these docs for the Rate Limit Handler plugin to prevent and manage rate limits
|
||||
- [https://docs.saloon.dev/installable-plugins/sdk-generator] Use these docs for the Auto SDK Generator plugin to generate Saloon SDKs from OpenAPI files or Postman collections
|
||||
- [https://docs.saloon.dev/installable-plugins/lawman] Use these docs for the Lawman plugin, a PestPHP plugin for writing architecture tests for API integrations
|
||||
- [https://docs.saloon.dev/installable-plugins/xml-wrangler] Use these docs for the XML Wrangler plugin for modern XML reading and writing with dot notation and XPath queries
|
||||
- [https://docs.saloon.dev/installable-plugins/building-your-own-plugins] Use these docs for building custom plugins (traits), creating boot methods, and extending Saloon functionality
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Integrations\Unifi\Requests;
|
||||
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
|
||||
class GetApplicationInformationRequest extends Request
|
||||
{
|
||||
/**
|
||||
* The HTTP method of the request
|
||||
*/
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
/**
|
||||
* The endpoint for the request
|
||||
*/
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/info';
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Integrations\Unifi\Requests;
|
||||
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
|
||||
class ListSitesRequest extends Request
|
||||
{
|
||||
/**
|
||||
* The HTTP method of the request
|
||||
*/
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
/**
|
||||
* The endpoint for the request
|
||||
*/
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/sites';
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Integrations\Unifi\Requests;
|
||||
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
|
||||
class ListWanInterfacesRequest extends Request
|
||||
{
|
||||
/**
|
||||
* The HTTP method of the request
|
||||
*/
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
public function __construct(
|
||||
protected readonly string $siteId,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* The endpoint for the request
|
||||
*/
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/sites/'.$this->siteId.'/wans';
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Integrations\Unifi;
|
||||
|
||||
use Saloon\Http\Connector;
|
||||
use Saloon\Traits\Plugins\AcceptsJson;
|
||||
|
||||
class UnifiConnector extends Connector
|
||||
{
|
||||
use AcceptsJson;
|
||||
|
||||
/**
|
||||
* The Base URL of the API
|
||||
*/
|
||||
public function resolveBaseUrl(): string
|
||||
{
|
||||
return config('services.unifi-api.base_url').'/proxy/network/integration/v1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Default config for the connector
|
||||
*/
|
||||
protected function defaultConfig(): array
|
||||
{
|
||||
return [
|
||||
'verify' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Default headers for the connector
|
||||
*/
|
||||
protected function defaultHeaders(): array
|
||||
{
|
||||
return [
|
||||
'X-API-KEY' => config('services.unifi-api.token'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,6 @@
|
||||
"lorisleiva/laravel-actions": "^2.10.1",
|
||||
"maennchen/zipstream-php": "^2.4",
|
||||
"promphp/prometheus_client_php": "^2.15.0",
|
||||
"saloonphp/laravel-plugin": "^4.3",
|
||||
"saloonphp/saloon": "^4.0",
|
||||
"secondnetwork/blade-tabler-icons": "^3.44.0",
|
||||
"spatie/laravel-json-api-paginate": "^2.0.1",
|
||||
"spatie/laravel-query-builder": "^6.4.4",
|
||||
|
||||
Generated
+1
-152
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6d1adfe12563e811889c55fb71da7e43",
|
||||
"content-hash": "eff9b12e2748e026bac5e8640796f786",
|
||||
"packages": [
|
||||
{
|
||||
"name": "blade-ui-kit/blade-heroicons",
|
||||
@@ -6109,157 +6109,6 @@
|
||||
],
|
||||
"time": "2026-03-19T10:36:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "saloonphp/laravel-plugin",
|
||||
"version": "v4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/saloonphp/laravel-plugin.git",
|
||||
"reference": "c9754084dabe1002000d01cc2192fd08cfa6079d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/saloonphp/laravel-plugin/zipball/c9754084dabe1002000d01cc2192fd08cfa6079d",
|
||||
"reference": "c9754084dabe1002000d01cc2192fd08cfa6079d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/console": "^11.0 || ^12.39.0 || ^13.0",
|
||||
"illuminate/support": "^11.0 || ^12.39.0 || ^13.0",
|
||||
"php": "^8.2",
|
||||
"saloonphp/saloon": "^4.0",
|
||||
"symfony/finder": "^6.4 || ^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.48",
|
||||
"laravel/pulse": "^1.4",
|
||||
"laravel/telescope": "^5.16",
|
||||
"orchestra/testbench": "^9.15 || ^10.7 || ^11.0",
|
||||
"pestphp/pest": "^3.0|^4.0",
|
||||
"phpstan/phpstan": "^1.10.57|^2.0.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Saloon": "Saloon\\Laravel\\Facades\\Saloon"
|
||||
},
|
||||
"providers": [
|
||||
"Saloon\\Laravel\\SaloonServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Saloon\\Laravel\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sam Carré",
|
||||
"email": "29132017+Sammyjo20@users.noreply.github.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "The official Laravel plugin for Saloon",
|
||||
"homepage": "https://github.com/saloonphp/laravel-plugin",
|
||||
"keywords": [
|
||||
"api",
|
||||
"api-integrations",
|
||||
"saloon",
|
||||
"saloonphp",
|
||||
"sdk"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/saloonphp/laravel-plugin/tree/v4.3.0"
|
||||
},
|
||||
"time": "2026-04-23T23:22:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "saloonphp/saloon",
|
||||
"version": "v4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/saloonphp/saloon.git",
|
||||
"reference": "1307b1d72cacdd2c9c20978cdf7a0b720b4bf3bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/saloonphp/saloon/zipball/1307b1d72cacdd2c9c20978cdf7a0b720b4bf3bb",
|
||||
"reference": "1307b1d72cacdd2c9c20978cdf7a0b720b4bf3bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^7.6",
|
||||
"guzzlehttp/promises": "^1.5 || ^2.0",
|
||||
"guzzlehttp/psr7": "^2.0",
|
||||
"php": "^8.2",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.1 || ^2.0"
|
||||
},
|
||||
"conflict": {
|
||||
"sammyjo20/saloon": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-simplexml": "*",
|
||||
"friendsofphp/php-cs-fixer": "^3.5",
|
||||
"illuminate/collections": "^10.0 || ^11.0 || ^12.0",
|
||||
"league/flysystem": "^3.0",
|
||||
"pestphp/pest": "^2.36.0 || ^3.8.2 || ^4.1.4",
|
||||
"phpstan/phpstan": "^2.1.13",
|
||||
"saloonphp/xml-wrangler": "^1.1",
|
||||
"spatie/invade": "^2.1",
|
||||
"symfony/dom-crawler": "^6.0 || ^7.0",
|
||||
"symfony/var-dumper": "^6.3 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/collections": "Required for the response collect() method.",
|
||||
"saloonphp/xml-wrangler": "Required for the response xmlReader() method.",
|
||||
"symfony/dom-crawler": "Required for the response dom() method.",
|
||||
"symfony/var-dumper": "Required for default debugging drivers."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Saloon\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sam Carré",
|
||||
"email": "29132017+Sammyjo20@users.noreply.github.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Build beautiful API integrations and SDKs with Saloon",
|
||||
"homepage": "https://github.com/saloonphp/saloon",
|
||||
"keywords": [
|
||||
"api",
|
||||
"api-integrations",
|
||||
"saloon",
|
||||
"sammyjo20",
|
||||
"sdk"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/saloonphp/saloon/issues",
|
||||
"source": "https://github.com/saloonphp/saloon/tree/v4.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sammyjo20",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-03-17T22:58:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "scrivo/highlight.php",
|
||||
"version": "v9.18.1.10",
|
||||
|
||||
@@ -6,9 +6,4 @@ return [
|
||||
'token' => env('TELEGRAM_BOT_TOKEN'),
|
||||
],
|
||||
|
||||
'unifi-api' => [
|
||||
'base_url' => env('UNIFI_API_BASE_URL', 'https://192.168.1.1'),
|
||||
'token' => env('UNIFI_API_TOKEN'),
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user