Supported frameworks
Version 0.1. Laravel 10 and later (including Octane and queue workers), plain PHP and Guzzle 7.Install
composer require codeskop/codeskop-phpLaravel
The service provider is discovered automatically. Add your project's public key:
CODESKOP_API_KEY=cs_live_pk_…That's all. Codeskop now:
- reports exceptions through Laravel's handler, skipping anything in
dontReport(404s, validation errors); - records every request by route (
/api/orders/{order}) with the signed-in user's ID; - records calls made with the HTTP client (
Http::get(…)).
To change the defaults, publish the config with php artisan vendor:publish --tag=codeskop-config.
Plain PHP
Call init at the top of your front controller. It reports uncaught exceptions (keeping any handler you already have), fatal errors including out-of-memory, and records the request.
<?phprequire __DIR__ . '/vendor/autoload.php'; \Codeskop\Codeskop::init(['api_key' => getenv('CODESKOP_API_KEY')]); // Optional: name the route of this request (otherwise IDs in the path become {id}).\Codeskop\Codeskop::setRoute('/orders/{id}');Report errors yourself
use Codeskop\Codeskop; try { $payments->charge($order);} catch (PaymentException $e) { Codeskop::captureException($e, tags: ['provider' => 'stripe']);} Codeskop::captureMessage('Inventory sync skipped');Codeskop::setUser((string) $user->id); // your own ID, never an emailOutgoing calls with Guzzle
$stack = \GuzzleHttp\HandlerStack::create();$stack->push(\Codeskop\Guzzle\Middleware::create()); $http = new \GuzzleHttp\Client(['handler' => $stack]);How events are sent
Under PHP-FPM, events are sent after the response is complete, so your users never wait on Codeskop. Queue workers and Octane send after each job or request. Remote settings are cached between requests in APCu when it's installed, otherwise in a small file in the system temp directory. ext-curl is recommended.
Options
| Option | Type | Default | Description |
|---|---|---|---|
| api_key | string | CODESKOP_API_KEY | The project's public key. Secret keys are refused and the SDK stays off. |
| environment | string | production | Laravel uses APP_ENV. Env var CODESKOP_ENVIRONMENT. |
| release | string | auto | Auto-detected from common hosts and CI. Env var CODESKOP_RELEASE. |
| capture_requests / capture_outgoing | bool | true | Incoming requests / outgoing calls. |
| ignore_routes | array | health checks | Glob patterns never recorded. |
| ignore_exceptions | array | [] | Exception classes never sent. |
| before_send | callable | null | Edit or drop any event before it's sent. |
| send_user_id | bool | true | Attach the signed-in user's ID. |
| flush_timeout | float | 2.0 | Seconds to spend sending at the end of a request. |
| debug | bool | false | Log what the SDK does (to error_log). |
Privacy
Never captured: request or response bodies, cookies, Authorization headers and query strings. See Privacy & Security.