Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
da8b838
feat(api): api update
stainless-app[bot] Sep 22, 2025
f992e92
chore(docs): update readme formatting
stainless-app[bot] Sep 23, 2025
e25fa02
chore: refactor methods
stainless-app[bot] Oct 4, 2025
d7d0f00
fix(ci): release doctor workflow
stainless-app[bot] Oct 9, 2025
7742369
chore: add license
stainless-app[bot] Oct 11, 2025
0112a9a
fix: inverted retry condition
stainless-app[bot] Oct 17, 2025
84053c4
feat!: remove confusing `toArray()` alias to `__serialize()` in favou…
stainless-app[bot] Oct 22, 2025
574d168
chore: use pascal case for phpstan typedefs
stainless-app[bot] Oct 30, 2025
9a72241
chore(client): send metadata headers
stainless-app[bot] Nov 4, 2025
fd0ab3b
fix: ensure auth methods return non-nullable arrays
stainless-app[bot] Nov 5, 2025
5bc4f8f
feat(client)!: redesign methods
stainless-app[bot] Nov 12, 2025
c124b7b
chore(internal): codegen related update
stainless-app[bot] Nov 13, 2025
6b7a996
fix: rename invalid types
stainless-app[bot] Nov 13, 2025
90a131a
feat(api): api update
stainless-app[bot] Jan 1, 2026
a45d08d
feat(api): api update
stainless-app[bot] Jan 5, 2026
43a24ef
feat(api): api update
stainless-app[bot] Jan 20, 2026
7bb648b
feat(api): api update
stainless-app[bot] Feb 1, 2026
bbcfa14
feat(api): api update
stainless-app[bot] Feb 3, 2026
ef87761
feat(api): manual updates
stainless-app[bot] Feb 14, 2026
8076e6e
codegen metadata
stainless-app[bot] Feb 14, 2026
eef2773
codegen metadata
stainless-app[bot] Feb 14, 2026
66215fb
chore: update SDK settings
stainless-app[bot] Feb 14, 2026
09f7055
codegen metadata
stainless-app[bot] Feb 14, 2026
6403d47
codegen metadata
stainless-app[bot] Feb 14, 2026
f6b0a97
codegen metadata
stainless-app[bot] Feb 14, 2026
eecf9f2
codegen metadata
stainless-app[bot] Feb 14, 2026
0c6c46b
release: 0.3.0
stainless-app[bot] Feb 14, 2026
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
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.php diff=php

/.github export-ignore
/bin export-ignore
/scripts export-ignore
/tests export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.phpactor.json export-ignore
/.release-please-manifest.json export-ignore
/.stats.yml export-ignore
/phpstan.dist.neon export-ignore
/phpunit.xml.dist export-ignore
/release-please-config.json export-ignore
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up PHP
uses: 'shivammathur/setup-php@v2'
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/cas-parser-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up PHP
uses: 'shivammathur/setup-php@v2'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ jobs:
if: github.repository == 'CASParser/cas-parser-php' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PACKAGIST_USERNAME: ${{ secrets.CAS_PARSER_PACKAGIST_USERNAME || secrets.PACKAGIST_USERNAME }}
PACKAGIST_SAFE_KEY: ${{ secrets.CAS_PARSER_PACKAGIST_SAFE_KEY || secrets.PACKAGIST_SAFE_KEY }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
composer.lock
docs/
.idea/
.php-cs-fixer.cache
Expand All @@ -9,3 +8,6 @@ playground/
*.swo
*.swp
vendor/

# do not edit! excludes generated files used internally
.artifacts/
4 changes: 3 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

return (new Config())
ini_set('memory_limit', -1);

return (new Config)
->setParallelConfig(ParallelConfigFactory::detect())
->setFinder(Finder::create()->in([__DIR__.'/src', __DIR__.'/tests']))
->setRules([
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.0"
".": "0.3.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 5
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-b7fdba3d3f97c7debc22c7ca30b828bce81bcd64648df8c94029b27a3321ebb9.yml
openapi_spec_hash: 03f1315f1d32ada42445ca920f047dff
config_hash: cb5d75abef6264b5d86448caf7295afa
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml
openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f
config_hash: 1af2e938c93ea4ec25fc633469072c43
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## 0.3.0 (2026-02-14)

Full Changelog: [v0.2.0...v0.3.0](https://github.com/CASParser/cas-parser-php/compare/v0.2.0...v0.3.0)

### ⚠ BREAKING CHANGES

* **client:** redesign methods
* remove confusing `toArray()` alias to `__serialize()` in favour of `toProperties()`

### Features

* **api:** api update ([bbcfa14](https://github.com/CASParser/cas-parser-php/commit/bbcfa141a593d0d34c361c8ff2192dbd9e1ff0e3))
* **api:** api update ([7bb648b](https://github.com/CASParser/cas-parser-php/commit/7bb648b9b9d87fa14c75e16628fe6d01e99f1198))
* **api:** api update ([43a24ef](https://github.com/CASParser/cas-parser-php/commit/43a24ef1b13a87d203170dcc187c90045472cdea))
* **api:** api update ([a45d08d](https://github.com/CASParser/cas-parser-php/commit/a45d08d64d5a4ad700f31d9180d5f79ce5ef06f2))
* **api:** api update ([90a131a](https://github.com/CASParser/cas-parser-php/commit/90a131ad218e94a908056b01fb8425ab8783bbd4))
* **api:** api update ([da8b838](https://github.com/CASParser/cas-parser-php/commit/da8b83821dab28680f72e98a943af25df296e314))
* **api:** manual updates ([ef87761](https://github.com/CASParser/cas-parser-php/commit/ef877615b3b873e5f2cf3a3dfeb37f50dbaf71d5))
* **client:** redesign methods ([5bc4f8f](https://github.com/CASParser/cas-parser-php/commit/5bc4f8fbca8bd998535963059460dcc2285c479e))
* remove confusing `toArray()` alias to `__serialize()` in favour of `toProperties()` ([84053c4](https://github.com/CASParser/cas-parser-php/commit/84053c4b32db33f341e5e9bf89f2aabe982a2695))


### Bug Fixes

* **ci:** release doctor workflow ([d7d0f00](https://github.com/CASParser/cas-parser-php/commit/d7d0f005e9022cce83d3316626e5746a3a02b694))
* ensure auth methods return non-nullable arrays ([fd0ab3b](https://github.com/CASParser/cas-parser-php/commit/fd0ab3bb4232369f31350fb47d0aca4d916f5739))
* inverted retry condition ([0112a9a](https://github.com/CASParser/cas-parser-php/commit/0112a9a50be77cb4681413034b3d88d791774f6c))
* rename invalid types ([6b7a996](https://github.com/CASParser/cas-parser-php/commit/6b7a99682bfce707850bfddeb41d2474f109ba83))


### Chores

* add license ([7742369](https://github.com/CASParser/cas-parser-php/commit/7742369f0a91046a7aa843391627e8931c6280f8))
* **client:** send metadata headers ([9a72241](https://github.com/CASParser/cas-parser-php/commit/9a72241ae57939ae08709709a26a87f1ad83d9e2))
* **docs:** update readme formatting ([f992e92](https://github.com/CASParser/cas-parser-php/commit/f992e921cd7043ea562ad58fb01905bd2039fa50))
* **internal:** codegen related update ([c124b7b](https://github.com/CASParser/cas-parser-php/commit/c124b7bdd9b7d6f7bbef3d386f9eb4038a6b20f3))
* refactor methods ([e25fa02](https://github.com/CASParser/cas-parser-php/commit/e25fa02ca0d7d49d88f1859c99e2db925a74e722))
* update SDK settings ([66215fb](https://github.com/CASParser/cas-parser-php/commit/66215fb06d105b7678b59b7de76f68181d0c24fa))
* use pascal case for phpstan typedefs ([574d168](https://github.com/CASParser/cas-parser-php/commit/574d1680fbbaccfc4281a98e33d205f4d8a7e043))

## 0.2.0 (2025-09-13)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/CASParser/cas-parser-php/compare/v0.1.0...v0.2.0)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2025 Cas Parser
Copyright 2026 Cas Parser

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
50 changes: 19 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Cas Parser PHP API library

> [!NOTE]
> The Cas Parser PHP API Library is currently in **beta** and we're excited for you to experiment with it!
>
> This library has not yet been exhaustively tested in production environments and may be missing some features you'd expect in a stable release. As we continue development, there may be breaking changes that require updates to your code.
>
> **We'd love your feedback!** Please share any suggestions, bug reports, feature requests, or general thoughts by [filing an issue](https://www.github.com/CASParser/cas-parser-php/issues/new).

The Cas Parser PHP library provides convenient access to the Cas Parser REST API from any PHP 8.1.0+ application.

It is generated with [Stainless](https://www.stainless.com/).

## Documentation

The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference).

## Installation

To use this package, install via Composer by adding the following to your application's `composer.json`:
Expand Down Expand Up @@ -47,11 +38,14 @@ Parameters with a default value must be set by name.

use CasParser\Client;

$client = new Client(apiKey: getenv("CAS_PARSER_API_KEY") ?: "My API Key");
$client = new Client(
apiKey: getenv('CAS_PARSER_API_KEY') ?: 'My API Key',
environment: 'environment_1',
);

$unifiedResponse = $client->casParser->smartParse();
$response = $client->credits->check();

var_dump($unifiedResponse->demat_accounts);
var_dump($response->enabled_features);
```

### Value Objects
Expand All @@ -69,15 +63,17 @@ When the library is unable to connect to the API, or if the API returns a non-su
<?php

use CasParser\Core\Exceptions\APIConnectionException;
use CasParser\Core\Exceptions\RateLimitException;
use CasParser\Core\Exceptions\APIStatusException;

try {
$unifiedResponse = $client->casParser->smartParse();
$response = $client->credits->check();
} catch (APIConnectionException $e) {
echo "The server could not be reached", PHP_EOL;
var_dump($e->getPrevious());
} catch (RateLimitError $_) {
} catch (RateLimitException $e) {
echo "A 429 status code was received; we should back off a bit.", PHP_EOL;
} catch (APIStatusError $e) {
} catch (APIStatusException $e) {
echo "Another non-200-range status code was received", PHP_EOL;
echo $e->getMessage();
}
Expand Down Expand Up @@ -111,16 +107,12 @@ You can use the `maxRetries` option to configure or disable this:
<?php

use CasParser\Client;
use CasParser\RequestOptions;

// Configure the default for all requests:
$client = new Client(maxRetries: 0);
$client = new Client(requestOptions: ['maxRetries' => 0]);

// Or, configure per-request:

$result = $client->casParser->smartParse(
requestOptions: RequestOptions::with(maxRetries: 5)
);
$result = $client->credits->check(requestOptions: ['maxRetries' => 5]);
```

## Advanced concepts
Expand All @@ -136,17 +128,13 @@ Note: the `extra*` parameters of the same name overrides the documented paramete
```php
<?php

use CasParser\RequestOptions;

$unifiedResponse = $client->casParser->smartParse(
requestOptions: RequestOptions::with(
extraQueryParams: ["my_query_parameter" => "value"],
extraBodyParams: ["my_body_parameter" => "value"],
extraHeaders: ["my-header" => "value"],
),
$response = $client->credits->check(
requestOptions: [
'extraQueryParams' => ['my_query_parameter' => 'value'],
'extraBodyParams' => ['my_body_parameter' => 'value'],
'extraHeaders' => ['my-header' => 'value'],
],
);

var_dump($unifiedResponse["my_undocumented_property"]);
```

#### Undocumented request params
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"$schema": "https://getcomposer.org/schema.json",
"license": "Apache-2.0",
"autoload": {
"files": ["src/Core.php", "src/Client.php"],
"files": [
"src/Version.php"
],
"psr-4": {
"CasParser\\": "src/"
}
Expand Down Expand Up @@ -37,6 +40,7 @@
"friendsofphp/php-cs-fixer": "^3",
"nyholm/psr7": "^1",
"pestphp/pest": "^3",
"php-http/mock-client": "^1",
"phpstan/extension-installer": "^1",
"phpstan/phpstan": "^2",
"phpstan/phpstan-phpunit": "^2",
Expand Down
Loading