Skip to content

Commit aacff56

Browse files
♻️ move all V1 and V2 logic to their own namespaces
1 parent 1719007 commit aacff56

73 files changed

Lines changed: 172 additions & 170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Mindee PHP API Library Changelog
22

3+
## v3.0.0-alpha1 - 2026-05-11
4+
### ¡Breaking Changes!
5+
*
6+
### Changes
7+
* :sparkles: add support for extraction in crop, split, and classification
8+
### Fixes
9+
*
10+
11+
312
## v2.9.0 - 2026-05-07
413
### Changes
514
* :sparkles: add support for extraction in crop, split, and classification

bin/MindeeCLICommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Mindee\CLI;
44

5-
use Mindee\Client;
65
use Mindee\Error\MindeeHttpException;
76
use Mindee\Input\InputSource;
87
use Mindee\Input\PageOptions;
@@ -12,12 +11,12 @@
1211
use Mindee\Input\URLInputSource;
1312
use Mindee\Parsing\Common\AsyncPredictResponse;
1413
use Mindee\Parsing\Common\PredictResponse;
14+
use Mindee\V1\Client;
1515
use Symfony\Component\Console\Command\Command;
1616
use Symfony\Component\Console\Input\InputArgument;
1717
use Symfony\Component\Console\Input\InputInterface;
1818
use Symfony\Component\Console\Input\InputOption;
1919
use Symfony\Component\Console\Output\OutputInterface;
20-
2120
use const Mindee\Input\KEEP_ONLY;
2221
use const Mindee\Input\REMOVE;
2322
use const Mindee\VERSION;

examples/InvoiceSplitterAutoExtractionExample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
use Mindee\Client;
43
use Mindee\Extraction\PdfExtractor;
54
use Mindee\Input\PathInput;
65
use Mindee\Product\Invoice\InvoiceV4;
76
use Mindee\Product\InvoiceSplitter\InvoiceSplitterV1;
7+
use Mindee\V1\Client;
88

99
function parseInvoice(string $filePath, Client $mindeeClient)
1010
{

examples/MultiReceiptsAutoExtractionExample.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
use Mindee\Client;
4-
use Mindee\V1\Image\ImageExtractor;
53
use Mindee\Input\PathInput;
64
use Mindee\Product\MultiReceiptsDetector\MultiReceiptsDetectorV1;
75
use Mindee\Product\Receipt\ReceiptV5;
6+
use Mindee\V1\Client;
7+
use Mindee\V1\Image\ImageExtractor;
88

99
$mindeeClient = new Client("my-api-key-here");
1010
// $mindeeClient = new Client(); // Optionally, use an environment variable.

src/Error/MindeeV2HttpException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Mindee\Error;
44

5-
use Mindee\Parsing\V2\ErrorResponse;
5+
use Mindee\V2\Parsing\ErrorResponse;
66

77
/**
88
* Exceptions relating to HTTP errors for the V2 API.

src/Error/MindeeV2HttpUnknownException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Mindee\Error;
44

5-
use Mindee\Parsing\V2\ErrorResponse;
5+
use Mindee\V2\Parsing\ErrorResponse;
66

77
/**
88
* Unknown HTTP error for the V2 API.

src/Input/PredictMethodOptions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
namespace Mindee\Input;
44

5-
use Mindee\Http\BaseEndpoint;
6-
use Mindee\Http\Endpoint;
7-
use Mindee\Http\WorkflowEndpoint;
5+
use Mindee\V1\HTTP\Endpoint;
6+
use Mindee\V1\HTTP\WorkflowEndpoint;
87

98
/**
109
* Handles options tied to prediction method.

src/Client.php renamed to src/V1/Client.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,15 @@
66
* Handles most basic operations of the library.
77
*/
88

9-
namespace Mindee;
9+
namespace Mindee\V1;
1010

1111
use Exception;
12+
use Mindee\CustomSleepMixin;
1213
use Mindee\Error\ErrorCode;
1314
use Mindee\Error\MindeeApiException;
1415
use Mindee\Error\MindeeClientException;
1516
use Mindee\Error\MindeeException;
1617
use Mindee\Error\MindeeHttpException;
17-
use Mindee\Http\Endpoint;
18-
use Mindee\Http\MindeeApi;
19-
use Mindee\Http\MindeeWorkflowApi;
20-
use Mindee\Http\ResponseValidation;
21-
use Mindee\Http\WorkflowEndpoint;
2218
use Mindee\Input\Base64Input;
2319
use Mindee\Input\BytesInput;
2420
use Mindee\Input\FileInput;
@@ -35,6 +31,11 @@
3531
use Mindee\Parsing\Common\PredictResponse;
3632
use Mindee\Parsing\Common\WorkflowResponse;
3733
use Mindee\Product\Generated\GeneratedV1;
34+
use Mindee\V1\HTTP\Endpoint;
35+
use Mindee\V1\HTTP\MindeeAPI;
36+
use Mindee\V1\HTTP\MindeeWorkflowAPI;
37+
use Mindee\V1\HTTP\ResponseValidation;
38+
use Mindee\V1\HTTP\WorkflowEndpoint;
3839
use ReflectionClass;
3940
use ReflectionException;
4041

@@ -158,7 +159,7 @@ private function constructEndpoint(
158159
): Endpoint {
159160
$endpointVersion = $endpointVersion != null && strlen($endpointVersion) > 0 ? $endpointVersion : '1';
160161

161-
$endpointSettings = new MindeeApi($this->apiKey, $endpointName, $endpointOwner, $endpointVersion);
162+
$endpointSettings = new MindeeAPI($this->apiKey, $endpointName, $endpointOwner, $endpointVersion);
162163

163164
return new Endpoint($endpointName, $endpointOwner, $endpointVersion, $endpointSettings);
164165
}
@@ -329,7 +330,7 @@ private function makeWorkflowExecutionRequest(
329330
string $workflowId,
330331
PredictMethodOptions $options
331332
): WorkflowResponse {
332-
$workflowRouterSettings = new MindeeWorkflowApi($this->apiKey, $workflowId);
333+
$workflowRouterSettings = new MindeeWorkflowAPI($this->apiKey, $workflowId);
333334
$options->endpoint = new WorkflowEndpoint($workflowRouterSettings);
334335
if (!$options->pageOptions->isEmpty()) {
335336
if ($inputDoc instanceof LocalInputSource) {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Settings and variables linked to all API usage.
55
*/
66

7-
namespace Mindee\Http;
7+
namespace Mindee\V1\HTTP;
88

99
/**
1010
* Default key name for the API key entry in environment variables.
@@ -30,7 +30,7 @@
3030
*/
3131
const TIMEOUT_DEFAULT = 120;
3232
// phpcs:disable
33-
include_once(dirname(__DIR__) . '/version.php');
33+
include_once(dirname(__DIR__, 2) . '/version.php');
3434
// phpcs:enable
3535

3636
use const Mindee\VERSION;
@@ -54,7 +54,7 @@ function getUserAgent(): string
5454
/**
5555
* Base class for API settings.
5656
*/
57-
abstract class BaseApi
57+
abstract class BaseAPI
5858
{
5959
/**
6060
* @var string|null API key.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php
22

3-
namespace Mindee\Http;
3+
namespace Mindee\V1\HTTP;
44

55
/**
66
* Abstract class for endpoints.
77
*/
88
abstract class BaseEndpoint
99
{
1010
/**
11-
* @var MindeeApi|MindeeWorkflowApi Settings of the endpoint.
11+
* @var MindeeAPI|MindeeWorkflowAPI Settings of the endpoint.
1212
*/
1313
public $settings;
1414

1515
/**
16-
* @param MindeeApi|MindeeWorkflowApi $settings Input settings.
16+
* @param MindeeAPI|MindeeWorkflowAPI $settings Input settings.
1717
*/
1818
public function __construct($settings)
1919
{

0 commit comments

Comments
 (0)