mediapart/lapresselibre-bundle
最新稳定版本:v2.0.1
Composer 安装命令:
composer require mediapart/lapresselibre-bundle
包简介
Symfony bundle of mediapart/lapresselibre library
README 文档
README
Installation
Install the package with Composer:
composer require mediapart/lapresselibre-bundle
Load the bundle into your Kernel:
# app/AppKernel.php $bundles = array( // ... new Mediapart\Bundle\LaPresseLibreBundle\MediapartLaPresseLibreBundle(), );
Configure your App with your LaPresseLibre partner credentials:
# app/config/config.yml mediapart_la_presse_libre: public_key: %lapresselibre_publickey% secret_key: %lapresselibre_secretkey% aes_password: %lapresselibre_aespassword% aes_iv: %lapresselibre_aesiv%
WebServices
Configure the routing:
# app/config/routing.yml MediapartLaPresseLibreWebServices: resource: "@MediapartLaPresseLibreBundle/Resources/config/routing/webservices.php" #prefix: lapresselibre/
And then, indicates your endpoints uri into LaPresseLibre partner platform.
Define what your endpoints have to do. For example, Your verification endpoint will look like :
<?php # src/Acme/LaPresseLibre/Verification.php namespace AppBundle\LaPresseLibre; use Mediapart\LaPresseLibre\Subscription\Type as SubscriptionType; class Verification { private $public_key; public function __construct($public_key) { $this->public_key = $public_key; } public function alwaysVerifiedAccounts(array $data, $isTesting = false) { $now = new \DateTime('next year'); return [ 'Mail' => $data['Mail'], 'CodeUtilisateur' => $data['CodeUtilisateur'], 'TypeAbonnement' => SubscriptionType::MONTHLY, 'DateExpiration' => $now->format("Y-m-d\TH:i:sO"), 'DateSouscription' => $now->format("Y-m-d\TH:i:sO"), 'AccountExist' => true, 'PartenaireID' => $this->public_key, ]; } }
# app/config/services.yml services: your_verification_service: class: 'AppBundle\LaPresseLibre\Verification' arguments: - '%lapresselibre_publickey%' tags: - { name: 'lapresselibre', route: 'lapresselibre_verification', operation: 'Mediapart\LaPresseLibre\Operation\Verification', method: 'alwaysVerifiedAccounts' }
Link Account
https://github.com/NextINpact/LaPresseLibreSDK/wiki/Liaison-de-compte-utilisateur-par-redirection
Configure the routing:
# app/config/routing.yml MediapartLaPresseLibreLinkAccount: resource: "@MediapartLaPresseLibreBundle/Resources/config/routing/link-account.php" #prefix: lapresselibre/
Implements Mediapart/LaPresseLibre/Account/Repository and Mediapart\Bundle\LaPresseLibreBundle\Account\AccountProvider interfaces.
# app/config/services.yml services: # … your_account_repository: class: 'AppBundle\LaPresseLibre\AccountRepository' your_account_provider: class: 'AppBundle\LaPresseLibre\AccountProvider'
Update the config :
# app/config/config.yml mediapart_lapresselibre: # … account: repository: 'your_account_repository' provider: 'your_account_provider'
统计信息
- 总下载量: 9.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC
- 更新时间: 2017-09-22