PHPackages                             justinwoodring/laravel-qiskit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. justinwoodring/laravel-qiskit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

justinwoodring/laravel-qiskit
=============================

Laravel PHP package for IBM Quantum / Qiskit Runtime

00PHPCI passing

Since Mar 13Pushed 1w agoCompare

[ Source](https://github.com/JustinWoodring/laravel-qiskit)[ Packagist](https://packagist.org/packages/justinwoodring/laravel-qiskit)[ RSS](/packages/justinwoodring-laravel-qiskit/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-qiskit
==============

[](#laravel-qiskit)

**Quantum computing for Laravel — submit circuits, poll results, and handle IBM Quantum jobs just like you'd handle anything else in your app.**

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://php.net)[![Laravel](https://camo.githubusercontent.com/934c60d4b198c50fe53587c7ef11138695a83b6f668b40ef8f995dab4ac7b805/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d726564)](https://laravel.com)

---

Overview
--------

[](#overview)

`laravel-qiskit` is a first-class Laravel package for [IBM Quantum](https://quantum.ibm.com/) / Qiskit Runtime. It brings quantum job submission into the Laravel ecosystem you already know — Eloquent models, queued jobs, events, Artisan commands, and a fluent facade — so you can focus on your circuits instead of the API plumbing.

Features
--------

[](#features)

- **Fluent circuit builder** — chainable gate API with OPENQASM 3.0 serialization
- **Sampler &amp; Estimator primitives** — mirrors the Qiskit Runtime primitive interface
- **Async job dispatch** — jobs go through Laravel's queue; polling happens automatically via a background job chain
- **Event-driven results** — listen for `QuantumJobCompleted` and get counts or expectation values
- **Session management** — open, close, or `run()` a session with auto-close
- **Backend discovery** — filter backends by qubit count, queue depth, and availability
- **Eloquent model** — `QuantumJob` with scopes, status constants, and a `PrimitiveResult` accessor
- **Artisan commands** — `qiskit:install`, `qiskit:jobs`, `qiskit:status`, `qiskit:cancel`, `qiskit:backends`

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, or 12
- An [IBM Quantum](https://quantum.ibm.com/account) account (API key + Service CRN)

Installation
------------

[](#installation)

```
composer require justinwoodring/laravel-qiskit
```

Publish the config and run migrations:

```
php artisan qiskit:install
```

Add your credentials to `.env`:

```
QISKIT_API_KEY=your-ibm-quantum-api-key
QISKIT_SERVICE_CRN=crn:v1:bluemix:public:quantum-computing:us-east:...
QISKIT_DEFAULT_BACKEND=ibm_brisbane
```

Quick Start
-----------

[](#quick-start)

### Build a circuit

[](#build-a-circuit)

```
use JustinWoodring\LaravelQiskit\Circuit\Circuit;

// Bell state — maximally entangled 2-qubit state
$circuit = Circuit::new(2, 2)
    ->h(0)
    ->cx(0, 1)
    ->measure();

echo $circuit->toQasm();
```

```
OPENQASM 3.0;
include "stdgates.inc";

qubit[2] q;
bit[2] c;

h q[0];
cx q[0], q[1];
c[0] = measure q[0];
c[1] = measure q[1];

```

### Submit a Sampler job (async)

[](#submit-a-sampler-job-async)

```
use JustinWoodring\LaravelQiskit\Facades\Qiskit;

$job = Qiskit::sampler('ibm_brisbane')
    ->addPub($circuit, shots: 4096)
    ->dispatch()   // → PendingJob
    ->dispatch();  // → QuantumJob (Eloquent model, enqueues to queue)

// $job->id, $job->status, $job->backend ...
```

Start your queue worker to process the submission and polling:

```
php artisan queue:work
```

### Listen for results

[](#listen-for-results)

```
// app/Providers/EventServiceProvider.php
use JustinWoodring\LaravelQiskit\Events\QuantumJobCompleted;

protected $listen = [
    QuantumJobCompleted::class => [
        App\Listeners\HandleQuantumResults::class,
    ],
];
```

```
// app/Listeners/HandleQuantumResults.php
public function handle(QuantumJobCompleted $event): void
{
    $counts = $event->result->getCounts();
    // ['00' => 2048, '11' => 2048]
}
```

### Estimator with observables

[](#estimator-with-observables)

```
use JustinWoodring\LaravelQiskit\Circuit\Circuit;
use JustinWoodring\LaravelQiskit\Facades\Qiskit;

$ansatz = Circuit::new(2)
    ->withParameters(['theta'])
    ->ry('theta', 0)
    ->cx(0, 1);

$job = Qiskit::estimator()
    ->addPub($ansatz->bind(['theta' => M_PI / 3]), observables: ['ZZ', 'XI'])
    ->dispatch()
    ->dispatch();
```

### Sessions

[](#sessions)

Reserve a backend across multiple jobs to avoid re-queuing between iterations:

```
Qiskit::sessions()->run('ibm_brisbane', function (string $sessionId) {
    Qiskit::sampler()->addPub($circuit1)->inSession($sessionId)->dispatch()->dispatch();
    Qiskit::sampler()->addPub($circuit2)->inSession($sessionId)->dispatch()->dispatch();
    // Session closes automatically when the callback returns
});
```

### Backend discovery

[](#backend-discovery)

```
// All online real hardware with at least 100 qubits
$backends = Qiskit::backends()
    ->filter()
    ->online()
    ->simulator(false)
    ->withMinQubits(100)
    ->withMaxQueueDepth(30)
    ->get();
```

Artisan Commands
----------------

[](#artisan-commands)

```
# Publish config + run migrations
php artisan qiskit:install

# List jobs
php artisan qiskit:jobs
php artisan qiskit:jobs --status=completed --limit=50

# Check job status
php artisan qiskit:status 42
php artisan qiskit:status cj1abc123def --ibm-id

# Cancel a job
php artisan qiskit:cancel 42

# List backends
php artisan qiskit:backends
php artisan qiskit:backends --online
```

Configuration
-------------

[](#configuration)

After running `qiskit:install`, edit `config/qiskit.php`:

```
return [
    'api_key'         => env('QISKIT_API_KEY'),
    'service_crn'     => env('QISKIT_SERVICE_CRN'),
    'base_url'        => env('QISKIT_BASE_URL', 'https://us-east.quantum-computing.cloud.ibm.com'),
    'default_backend' => env('QISKIT_DEFAULT_BACKEND', 'ibm_brisbane'),

    'polling' => [
        'interval'     => env('QISKIT_POLL_INTERVAL', 10),      // seconds
        'max_attempts' => env('QISKIT_POLL_MAX_ATTEMPTS', 360),  // ~1 hour
        'queue'        => env('QISKIT_POLL_QUEUE', null),
    ],

    'http' => [
        'timeout' => env('QISKIT_HTTP_TIMEOUT', 30),
        'retry'   => ['times' => 3, 'sleep' => 1000],
    ],
];
```

Events
------

[](#events)

EventPayload`QuantumJobSubmitted``$job`, `$ibmJobId``QuantumJobCompleted``$job`, `$result` (`PrimitiveResult`)`QuantumJobFailed``$job`, `$reason``QuantumJobCancelled``$job`Circuit Gates
-------------

[](#circuit-gates)

MethodGate`h(q)`Hadamard`x(q)` `y(q)` `z(q)`Pauli X / Y / Z`s(q)` `t(q)`S / T phase`rx(θ, q)` `ry(θ, q)` `rz(φ, q)`Rotation gates`cx(c, t)` / `cnot(c, t)`Controlled-X`cz(c, t)`Controlled-Z`swap(a, b)`SWAP`ccx(c1, c2, t)` / `toffoli(...)`Toffoli`measure()`Measure all qubits`measureQubit(q, c)`Measure qubit `q` into classical bit `c`Parameterized circuits:

```
$circuit = Circuit::new(1)
    ->withParameters(['theta'])
    ->ry('theta', 0)
    ->bind(['theta' => 1.5707]);
```

Testing
-------

[](#testing)

```
composer install
./vendor/bin/phpunit
```

Tests use [Orchestra Testbench](https://github.com/orchestral/testbench) with an in-memory SQLite database and faked HTTP responses — no real IBM Quantum credentials needed.

Demo
----

[](#demo)

A full demo Laravel app lives in [`demo/`](demo/). See [`demo/README.md`](demo/README.md) for setup instructions.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

20

—

LowBetter than 16% of packages

Maintenance64

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0779b9c711ff93431b18b183da5776576654fa116afbd250d00e0687ac309bbd?d=identicon)[JustinWoodring](/maintainers/JustinWoodring)

---

Top Contributors

[![JustinWoodring](https://avatars.githubusercontent.com/u/41842051?v=4)](https://github.com/JustinWoodring "JustinWoodring (8 commits)")

---

Tags

laravelphpqiskitquantum-computing

### Embed Badge

![Health badge](/badges/justinwoodring-laravel-qiskit/health.svg)

```
[![Health](https://phpackages.com/badges/justinwoodring-laravel-qiskit/health.svg)](https://phpackages.com/packages/justinwoodring-laravel-qiskit)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
