Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add PublicClient HTTP layer for unauthenticated requests

+28
+28
src/Client/Public/PublicClient.php
··· 1 + <?php 2 + 3 + namespace SocialDept\AtpClient\Client\Public; 4 + 5 + use Illuminate\Support\Facades\Http; 6 + use SocialDept\AtpClient\Http\Response; 7 + 8 + class PublicClient 9 + { 10 + public function __construct( 11 + protected string $serviceUrl 12 + ) {} 13 + 14 + public function get(string $endpoint, array $params = []): Response 15 + { 16 + $url = rtrim($this->serviceUrl, '/') . '/xrpc/' . $endpoint; 17 + $params = array_filter($params, fn ($v) => !is_null($v)); 18 + 19 + $response = Http::get($url, $params); 20 + 21 + return new Response($response); 22 + } 23 + 24 + public function serviceUrl(): string 25 + { 26 + return $this->serviceUrl; 27 + } 28 + }