Skip to content

Commit 4fd1701

Browse files
authored
Update README.md
1 parent 68ebdd5 commit 4fd1701

1 file changed

Lines changed: 4 additions & 106 deletions

File tree

README.md

Lines changed: 4 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -2,112 +2,10 @@
22

33
A PHP SDK for the Polyscope API, built in a Laravel-friendly style.
44

5-
## Installation
5+
## Official Documentation
66

7-
```bash
8-
composer require beyondcode/polyscope
9-
```
7+
Documentation for the Polyscope Laravel SDK can be found on the [Polyscope website](https://getpolyscope.com/docs/integrations/laravel-php-sdk).
108

11-
## Quick Start
9+
## License
1210

13-
```php
14-
use Polyscope\Laravel\Polyscope;
15-
16-
$polyscope = new Polyscope('your-api-token');
17-
18-
$servers = $polyscope->servers();
19-
$repositories = $polyscope->repositories();
20-
$workspaces = $polyscope->workspaces();
21-
22-
// Create a workspace directly from a repository resource.
23-
$workspace = $repositories[0]->createWorkspace([
24-
'prompt' => 'Fix the login flow',
25-
'server_id' => 'srv-1', // optional
26-
]);
27-
28-
// Or use a prompt string shorthand.
29-
$workspace = $repositories[0]->createWorkspace('Fix the login flow');
30-
```
31-
32-
If no token is passed, the SDK automatically falls back to Polyscope's local settings file and reads `authToken`.
33-
By default it checks:
34-
35-
- `~/.polyscope/settings.json`
36-
- `~/Library/Application Support/com.getpolyscope.app/settings.json`
37-
- `~/.config/com.getpolyscope.app/settings.json`
38-
- `%APPDATA%/com.getpolyscope.app/settings.json`
39-
40-
You can override this with:
41-
42-
```bash
43-
POLYSCOPE_SETTINGS_PATH=/custom/path/settings.json
44-
```
45-
46-
If you need a custom base URL:
47-
48-
```php
49-
$polyscope = (new Polyscope())
50-
->setBaseUrl('https://your-polyscope-instance.com')
51-
->setApiToken('your-api-token');
52-
```
53-
54-
## Laravel Integration
55-
56-
The SDK auto-registers a service provider. Add credentials to `config/services.php`:
57-
58-
```php
59-
'polyscope' => [
60-
'token' => env('POLYSCOPE_TOKEN'),
61-
'url' => env('POLYSCOPE_URL', 'https://getpolyscope.com'),
62-
],
63-
```
64-
65-
Then use the facade:
66-
67-
```php
68-
use Polyscope\Laravel\Facades\Polyscope;
69-
70-
$workspace = Polyscope::createWorkspace([
71-
'repository_id' => 'repo-1',
72-
'prompt' => 'Fix the login flow and add tests',
73-
]);
74-
```
75-
76-
## Supported API Areas (v1 only)
77-
78-
- Servers: `servers()`
79-
- Repositories: `repositories()`
80-
- Workspaces: `workspaces()`, `createWorkspace()`, `workspace()`, `deleteWorkspace()`
81-
- Workspace messages: `workspaceMessages()`, `sendWorkspaceMessage()`
82-
- Workspace actions: `workspaceDiff()`, `commitWorkspace()`, `createWorkspacePullRequest()`, `stopWorkspace()`
83-
84-
## Error Handling
85-
86-
The SDK maps common HTTP/API failures to typed exceptions:
87-
88-
- `ValidationException`
89-
- `AuthenticationException`
90-
- `ForbiddenException`
91-
- `NotFoundException`
92-
- `RateLimitExceededException`
93-
- `ServerOfflineException`
94-
- `ServerTimeoutException`
95-
- `ApiException`
96-
97-
Example:
98-
99-
```php
100-
use Polyscope\Laravel\Exceptions\ValidationException;
101-
102-
try {
103-
$polyscope->createWorkspace(['prompt' => 'Missing repository_id']);
104-
} catch (ValidationException $e) {
105-
$errors = $e->errors();
106-
}
107-
```
108-
109-
## Development
110-
111-
```bash
112-
composer test
113-
```
11+
Laravel Boost is open-sourced software licensed under the [MIT license](LICENSE.md).

0 commit comments

Comments
 (0)