nettob/rdw-bundle

此包已被废弃,不再维护。未建议替代包。

此 Symfony2 包提供检索 RDW 数据的服务。

安装: 0

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 0

分支: 0

开放问题: 0

类型:symfony-bundle

v1.3 2016-04-04 13:44 UTC

This package is not auto-updated.

Last update: 2020-01-24 16:16:05 UTC


README

此 Symfony2 包提供检索 RDW 数据的服务。

安装

将包添加到您的 composer.json 文件中

require: {
    // ...
    "nettob/rdw-bundle": "1.*"
    // ...
}

然后运行 composer update

composer.phar update
# OR
composer.phar update nettob/rdw-bundle # to only update the bundle

在您的内核中注册此包

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Nettob\Bundle\RdwBundle\NettobRdwBundle(),
    // ...
);

配置

最小配置

# app/config/config.yml
nettob_rdw:
    api_key: "YOURAPIKEY"  # [required] the api key from your dataset on azure.

附加选项(此处显示默认值)

# app/config/config.yml
nettob_rdw:
    content_type: "json" # currently only json could be used.

使用方法

服务

两种方法都返回一个 Nettob\Component\Rdw\Model\Kenteken 对象数组。

FindAll

$limit = 100; # Limit of number plates.
$offset = 100; # offset of number plates.
$this->get('nettob_rdw.adapter')->findAll($limit, $offset);

FindBy

目前只允许一个属性。

$key = 'Kenteken'; # See Nettob\Component\Rdw\Model\Kenteken for the available properties.
$value = 'string'; # String or number to search for.
$type = Nettob\Component\Rdw\Model\KentekenRepository::TYPE_EQ #See Nettob\Component\Rdw\Model\Kenteken::getTypes for the available types.
$limit = 100; # Limit of number plates.
$offset = 100; # offset of number plates.
$this->get('nettob_rdw.adapter')->findBy($key, $vale, $type, $limit, $offset);

控制台

此包有一个搜索命令。此命令调用服务中的 findby 方法。

php app/console nettob_rdw:search --key="Kenteken" --value="00AABB" --type="eq" --limit=1 --offset=0

API

数据集可在名为 [Voertuig Open Data] 的 Azure 市场中获得(https://datamarket.azure.com/dataset/opendata.rdw/vrtg.open.data)。请求访问数据集,并从您的账户(https://datamarket.azure.com/account)中检索您的 API 密钥。您可以在[此处]找到数据集的手册(https://www.rdw.nl/opendata/Paginas/handleidingen.aspx?Path=Portal/OpenData