kitlabs / neo4j-bundle
Neo4j 的 Symfony 集成
10.4.2
2024-02-21 08:28 UTC
Requires
- php: >=8.0
- ext-json: *
- kitlabs/neo4j-php-client: ^13.0
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- twig/twig: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.30
- kubawerlos/php-cs-fixer-custom-fixers: ^3.0
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.18
- psalm/plugin-symfony: ^5.0
- symfony/console: ^5.4 || ^6.0
- symfony/framework-bundle: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/test-pack: ^1.1
- symfony/yaml: ^5.4 || ^6.0
- vimeo/psalm: ^5.15.0
This package is auto-updated.
Last update: 2024-09-21 09:50:38 UTC
README
安装
确保全局已安装 Composer,如 Composer 文档中的 安装章节 所述。
不使用 Symfony Flex 的应用程序
步骤 1: 下载 Bundle
打开命令行,进入项目目录,然后执行以下命令以下载此 Bundle 的最新稳定版本
$ composer require kitlabs/neo4j-bundle
步骤 2: 启用 Bundle
然后,通过将其添加到项目 config/bundles.php
文件中注册的 Bundle 列表中启用该 Bundle
// config/bundles.php return [ // ... \Neo4j\Neo4jBundle\Neo4jBundle::class => ['all' => true], ];
文档
该 Bundle 是注册服务的便捷方式。我们注册了 Drivers
和一个 Clients
。您将始终有默认服务的别名
- neo4j.driver
- neo4j.client
最小配置
neo4j: drivers: default: ~
使用最小配置,我们拥有以下命名的服务
- neo4j.driver.default
- neo4j.client
完整配置示例
此示例配置客户端包含两个实例。
neo4j: profiling: true default_driver: high-availability connections: - alias: high-availability dsn: 'neo4j://core1.mydomain.com:7687' authentication: type: 'oidc' token: '%neo4j.openconnect-id-token%' priority: 1 # Overriding the alias makes it so that there is a backup server to use in case # the routing table cannot be fetched through the driver with a higher priority # but the same alias. # Once the table is fetched it will use that information to auto-route as usual. - alias: high-availability dsn: 'neo4j://core2.mydomain.com:7687' priority: 0 authentication: type: 'oidc' token: '%neo4j.openconnect-id-token%' - alias: backup-instance dsn: 'bolt://localhost:7687' authentication: type: basic username: '%neo4j.backup-user%' password: '%neo4j.backup-pass%'
测试
$ composer test
示例应用程序
在 https://github.com/neo4j-examples/movies-symfony-php-bolt(旧项目)中查看示例应用程序
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件