Skip to content

Commit ea70b29

Browse files
committed
feat!: Remove HTTP
1 parent 7492476 commit ea70b29

23 files changed

+31
-2745
lines changed

.github/workflows/integration-test-single-server.yml

-12
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ jobs:
4242
-e PHP_VERSION=${{ matrix.php }} \
4343
-e CONNECTION=bolt://neo4j:testtest@neo4j \
4444
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
45-
- name: Test http://
46-
run: |
47-
docker compose run \
48-
-e PHP_VERSION=${{ matrix.php }} \
49-
-e CONNECTION=http://neo4j:testtest@neo4j \
50-
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
5145
tests-v5:
5246
runs-on: ubuntu-latest
5347
strategy:
@@ -81,9 +75,3 @@ jobs:
8175
-e PHP_VERSION=${{ matrix.php }} \
8276
-e CONNECTION=bolt://neo4j:testtest@neo4j \
8377
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
84-
- name: Test http://
85-
run: |
86-
docker compose run \
87-
-e PHP_VERSION=${{ matrix.php }} \
88-
-e CONNECTION=http://neo4j:testtest@neo4j \
89-
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration

src/Authentication/BasicAuth.php

-17
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace Laudis\Neo4j\Authentication;
1515

16-
use function base64_encode;
17-
1816
use Bolt\protocol\V4_4;
1917
use Bolt\protocol\V5;
2018
use Bolt\protocol\V5_1;
@@ -25,7 +23,6 @@
2523
use Laudis\Neo4j\Common\Neo4jLogger;
2624
use Laudis\Neo4j\Common\ResponseHelper;
2725
use Laudis\Neo4j\Contracts\AuthenticateInterface;
28-
use Psr\Http\Message\RequestInterface;
2926
use Psr\Http\Message\UriInterface;
3027
use Psr\Log\LogLevel;
3128

@@ -43,20 +40,6 @@ public function __construct(
4340
private readonly ?Neo4jLogger $logger,
4441
) {}
4542

46-
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
47-
{
48-
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using BasicAuth');
49-
$combo = base64_encode($this->username.':'.$this->password);
50-
51-
/**
52-
* @psalm-suppress ImpureMethodCall Request is a pure object:
53-
*
54-
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message-meta.md#why-value-objects
55-
*/
56-
return $request->withHeader('Authorization', 'Basic '.$combo)
57-
->withHeader('User-Agent', $userAgent);
58-
}
59-
6043
/**
6144
* @throws Exception
6245
*

src/ClientBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
final class ClientBuilder
4343
{
44-
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc', 'http', 'https'];
44+
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc'];
4545

4646
/**
4747
* @psalm-mutation-free

src/Contracts/AuthenticateInterface.php

-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@
1919
use Bolt\protocol\V5_2;
2020
use Bolt\protocol\V5_3;
2121
use Bolt\protocol\V5_4;
22-
use Psr\Http\Message\RequestInterface;
2322
use Psr\Http\Message\UriInterface;
2423

2524
interface AuthenticateInterface
2625
{
27-
/**
28-
* Authenticates a RequestInterface with the provided configuration Uri and userAgent.
29-
*/
30-
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface;
31-
3226
/**
3327
* Authenticates a Bolt connection with the provided configuration Uri and userAgent.
3428
*

src/Contracts/FormatterInterface.php

-39
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,10 @@
1414
namespace Laudis\Neo4j\Contracts;
1515

1616
use Bolt\Bolt;
17-
use JsonException;
1817
use Laudis\Neo4j\Bolt\BoltConnection;
1918
use Laudis\Neo4j\Bolt\BoltResult;
2019
use Laudis\Neo4j\Databags\BookmarkHolder;
2120
use Laudis\Neo4j\Databags\Statement;
22-
use Laudis\Neo4j\Http\HttpConnection;
23-
use Laudis\Neo4j\Types\CypherList;
24-
use Psr\Http\Message\RequestInterface;
25-
use Psr\Http\Message\ResponseInterface;
26-
use stdClass;
2721

2822
/**
2923
* A formatter (aka Hydrator) is reponsible for formatting the incoming results of the driver.
@@ -81,37 +75,4 @@ interface FormatterInterface
8175
* @return ResultFormat
8276
*/
8377
public function formatBoltResult(array $meta, BoltResult $result, BoltConnection $connection, float $runStart, float $resultAvailableAfter, Statement $statement, BookmarkHolder $holder);
84-
85-
/**
86-
* Formats the results of the HTTP protocol to the unified format.
87-
*
88-
* @param iterable<Statement> $statements
89-
*
90-
* @throws JsonException
91-
*
92-
* @return CypherList<ResultFormat>
93-
*
94-
* @psalm-mutation-free
95-
*/
96-
public function formatHttpResult(ResponseInterface $response, stdClass $body, HttpConnection $connection, float $resultsAvailableAfter, float $resultsConsumedAfter, iterable $statements): CypherList;
97-
98-
/**
99-
* Decorates a request to make make sure it requests the correct format.
100-
*
101-
* @see https://neo4j.com/docs/http-api/current/actions/result-format/
102-
*
103-
* @psalm-mutation-free
104-
*/
105-
public function decorateRequest(RequestInterface $request, ConnectionInterface $connection): RequestInterface;
106-
107-
/**
108-
* Overrides the statement config of the HTTP protocol.
109-
*
110-
* @see https://neo4j.com/docs/http-api/current/actions/result-format/
111-
*
112-
* @return array{resultDataContents?: list<'GRAPH'|'ROW'|'REST'>, includeStats?:bool}
113-
*
114-
* @psalm-mutation-free
115-
*/
116-
public function statementConfigOverride(ConnectionInterface $connection): array;
11778
}

src/Databags/DriverConfiguration.php

+1-35
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@ final class DriverConfiguration
3939
public const DEFAULT_POOL_SIZE = 0x2F;
4040
public const DEFAULT_CACHE_IMPLEMENTATION = Cache::class;
4141
public const DEFAULT_ACQUIRE_CONNECTION_TIMEOUT = 2.0;
42-
/** @var callable():(HttpPsrBindings|null)|HttpPsrBindings|null */
43-
private $httpPsrBindings;
4442
/** @var callable():(CacheInterface|null)|CacheInterface|null */
4543
private $cache;
4644
/** @var callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null */
4745
private $semaphoreFactory;
4846
private ?Neo4jLogger $logger;
4947

5048
/**
51-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
5249
* @param callable():(CacheInterface|null)|CacheInterface|null $cache
5350
* @param callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null $semaphore
5451
* @param string|null $logLevel The log level to use. If null, LogLevel::INFO is used.
@@ -57,7 +54,6 @@ final class DriverConfiguration
5754
*/
5855
public function __construct(
5956
private string|null $userAgent,
60-
callable|HttpPsrBindings|null $httpPsrBindings,
6157
private SslConfiguration $sslConfig,
6258
private int|null $maxPoolSize,
6359
CacheInterface|callable|null $cache,
@@ -66,7 +62,6 @@ public function __construct(
6662
?string $logLevel,
6763
?LoggerInterface $logger
6864
) {
69-
$this->httpPsrBindings = $httpPsrBindings;
7065
$this->cache = $cache;
7166
$this->semaphoreFactory = $semaphore;
7267
if ($logger !== null) {
@@ -77,13 +72,10 @@ public function __construct(
7772
}
7873

7974
/**
80-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
81-
*
8275
* @pure
8376
*/
8477
public static function create(
8578
?string $userAgent,
86-
callable|HttpPsrBindings|null $httpPsrBindings,
8779
SslConfiguration $sslConfig,
8880
int $maxPoolSize,
8981
CacheInterface $cache,
@@ -94,7 +86,6 @@ public static function create(
9486
): self {
9587
return new self(
9688
$userAgent,
97-
$httpPsrBindings,
9889
$sslConfig,
9990
$maxPoolSize,
10091
$cache,
@@ -107,15 +98,14 @@ public static function create(
10798

10899
/**
109100
* Creates a default configuration with a user agent based on the driver version
110-
* and HTTP PSR implementation auto-detected from the environment.
101+
* auto-detected from the environment.
111102
*
112103
* @pure
113104
*/
114105
public static function default(): self
115106
{
116107
return new self(
117108
null,
118-
HttpPsrBindings::default(),
119109
SslConfiguration::default(),
120110
null,
121111
null,
@@ -160,21 +150,6 @@ public function withUserAgent($userAgent): self
160150
return $tbr;
161151
}
162152

163-
/**
164-
* Creates a new configuration with the provided bindings.
165-
*
166-
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $bindings
167-
*
168-
* @psalm-immutable
169-
*/
170-
public function withHttpPsrBindings($bindings): self
171-
{
172-
$tbr = clone $this;
173-
$tbr->httpPsrBindings = $bindings;
174-
175-
return $tbr;
176-
}
177-
178153
/**
179154
* @psalm-immutable
180155
*/
@@ -194,15 +169,6 @@ public function getSslConfiguration(): SslConfiguration
194169
return $this->sslConfig;
195170
}
196171

197-
public function getHttpPsrBindings(): HttpPsrBindings
198-
{
199-
$this->httpPsrBindings = (is_callable($this->httpPsrBindings)) ? call_user_func(
200-
$this->httpPsrBindings
201-
) : $this->httpPsrBindings;
202-
203-
return $this->httpPsrBindings ??= HttpPsrBindings::default();
204-
}
205-
206172
public function getMaxPoolSize(): int
207173
{
208174
return $this->maxPoolSize ?? self::DEFAULT_POOL_SIZE;

src/Databags/HttpPsrBindings.php

-133
This file was deleted.

0 commit comments

Comments
 (0)