Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ jobs:
- name: Prepare binary artifact
run: |
mkdir -p dist
cp target/x86_64-unknown-linux-gnu/release/libext_biscuit_php.so dist/ext_biscuit_php-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so
cp target/x86_64-unknown-linux-gnu/release/libbiscuit.so dist/biscuit-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so

- name: Calculate checksums
run: |
cd dist
sha256sum ext_biscuit_php-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so > ext_biscuit_php-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so.sha256
sha256sum biscuit-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so > biscuit-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so.sha256

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -98,11 +98,11 @@ jobs:
- name: Verify checksum
run: |
cd dist
sha256sum -c ext_biscuit_php-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so.sha256
sha256sum -c biscuit-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so.sha256

- name: Test binary loading
run: |
php -dextension=./dist/ext_biscuit_php-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so -m | grep biscuit || echo "Extension loaded successfully"
php -dextension=./dist/biscuit-linux-x86_64-php${{ matrix.php-version }}-${{ matrix.phpts }}.so -m | grep biscuit || echo "Extension loaded successfully"

create-release:
name: Create GitHub Release
Expand Down Expand Up @@ -137,14 +137,14 @@ jobs:

| Platform | PHP Version | Thread Safety | Binary | Checksum |
|----------|-------------|---------------|--------|----------|
| Linux x86_64 | 8.1 | TS | ext_biscuit_php-linux-x86_64-php8.1-ts.so | .sha256 |
| Linux x86_64 | 8.1 | NTS | ext_biscuit_php-linux-x86_64-php8.1-nts.so | .sha256 |
| Linux x86_64 | 8.2 | TS | ext_biscuit_php-linux-x86_64-php8.2-ts.so | .sha256 |
| Linux x86_64 | 8.2 | NTS | ext_biscuit_php-linux-x86_64-php8.2-nts.so | .sha256 |
| Linux x86_64 | 8.3 | TS | ext_biscuit_php-linux-x86_64-php8.3-ts.so | .sha256 |
| Linux x86_64 | 8.3 | NTS | ext_biscuit_php-linux-x86_64-php8.3-nts.so | .sha256 |
| Linux x86_64 | 8.4 | TS | ext_biscuit_php-linux-x86_64-php8.4-ts.so | .sha256 |
| Linux x86_64 | 8.4 | NTS | ext_biscuit_php-linux-x86_64-php8.4-nts.so | .sha256 |
| Linux x86_64 | 8.1 | TS | biscuit-linux-x86_64-php8.1-ts.so | .sha256 |
| Linux x86_64 | 8.1 | NTS | biscuit-linux-x86_64-php8.1-nts.so | .sha256 |
| Linux x86_64 | 8.2 | TS | biscuit-linux-x86_64-php8
| Linux x86_64 | 8.2 | NTS | biscuit-linux-x86_64-php8.2-nts.so | .sha256 |
| Linux x86_64 | 8.3 | TS | biscuit-linux-x86_64-php8.3-ts.so | .sha256 |
| Linux x86_64 | 8.3 | NTS | biscuit-linux-x86_64-php8.3-nts.so | .sha256 |
| Linux x86_64 | 8.4 | TS | biscuit-linux-x86_64-php8.4-ts.so | .sha256 |
| Linux x86_64 | 8.4 | NTS | biscuit-linux-x86_64-php8.4-nts.so | .sha256 |

### Choosing the Right Binary

Expand All @@ -162,12 +162,12 @@ jobs:
2. Download the appropriate binary for your PHP version and thread safety
3. Verify the checksum:
```bash
sha256sum -c ext_biscuit_php-linux-x86_64-php8.x-{ts|nts}.so.sha256
sha256sum -c biscuit-linux-x86_64-php8.x-{ts|nts}.so.sha256
```
4. Move the binary to your PHP extension directory
5. Add to your php.ini:
```ini
extension=ext_biscuit_php-linux-x86_64-php8.x-{ts|nts}.so
extension=biscuit-linux-x86_64-php8.x-{ts|nts}.so
```
6. Verify installation:
```bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
mago lint --reporting-format=github

- name: "Run PHPUnit"
run: php -dextension=./target/release/libext_biscuit_php.so vendor/bin/phpunit
run: php -dextension=./target/release/libbiscuit.so vendor/bin/phpunit
115 changes: 61 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[package]
name = "ext-biscuit-php"
name = "biscuit-php"
version = "0.1.0"
edition = "2021"
edition = "2024"
license = "Apache-2.0"
description = "PHP wrapper for Biscuit authorization tokens"
authors = ["Pierre Tondereau <[email protected]>"]

[dependencies]
ext-php-rs = "0.14.2"
ext-php-rs = "0.15"
biscuit-auth = { version = "6.0.0", features = ["pem"] }
hex = "0.4"

[lib]
name = "ext_biscuit_php"
name = "biscuit"
crate-type = ["cdylib"]

[profile.release]
strip = "debuginfo"
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ sudo phpenmod biscuit
php -m | grep biscuit
```

### PIE installation

We support [PIE](https://github.com/php/pie/) installation:
```bash
pie install ptondereau/biscuit-php
```

and you can add in your `composer.json`:
```json
{
// ...
"ext-biscuit": "*",
// ...
}
```


### Build from Source

If pre-built binaries are not available for your platform:
Expand Down
16 changes: 14 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "ptondereau/ext-biscuit-php",
"$schema": "https://getcomposer.org/schema.json",
"name": "ptondereau/biscuit-php",
"description": "PHP bindings for Biscuit authorization tokens",
"type": "library",
"license": "Apache-2.0",
"type": "php-ext",
"authors": [
{
"name": "Pierre Tondereau",
Expand Down Expand Up @@ -30,5 +31,16 @@
"allow-plugins": {
"carthage-software/mago": true
}
},
"php-ext": {
"build-path": "pie",
"extension-name": "biscuit",
"configure-options": [
{
"name": "debug",
"description": "Build in debug mode",
"needs-value": false
}
]
}
}
Loading
Loading