happyr / linkedin-bundle
一个用于 happyr/linkedin-api-client 的 symfony 扩展包
1.0.0
2018-02-04 17:19 UTC
Requires
- php: ^5.5 || ^7.0
- happyr/linkedin-api-client: ^1.0
- symfony/dependency-injection: ^2.3 || ^3.0 || ^4.0
- symfony/http-kernel: ^2.3 || ^3.0 || ^4.0
Requires (Dev)
- guzzlehttp/psr7: ^1.4
- nyholm/symfony-bundle-test: ^1.3.1
- php-http/curl-client: ^1.7
- php-http/httplug-bundle: ^1.8
- php-http/message: ^1.6
- symfony/phpunit-bridge: ^3.4 || ^4.0
Suggests
- php-http/httplug-bundle: For easier configure your HTTP clients
This package is auto-updated.
Last update: 2024-08-25 07:00:04 UTC
README
这是一个非常小巧的扩展包,用于注册 LinkedIn 客户端的服务。
简单安装
为了方便安装所有组件,您可以运行以下 Composer 命令
composer require php-http/curl-client guzzlehttp/psr7 php-http/message happyr/linkedin-bundle
然后将 LinkedInBundle 添加到您的 AppKernel 中。
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Happyr\LinkedInBundle\HappyrLinkedInBundle() ); } }
可选
如果您希望进行出色的调试和更简单的设置,您可能需要安装 HTTPlugBundle。
composer require php-http/httplug-bundle
然后确保您已经在 AppKernel 中添加了 HttplugBundle 和 LinkedInBundle。
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Http\HttplugBundle\HttplugBundle(), new Happyr\LinkedInBundle\HappyrLinkedInBundle() ); } }
为什么安装这么多包?
请参阅LinkedIn 客户端(安装)或 HTTPlug 文档中的安装说明。
使用方法
happyr_linkedin: app_id: 'xxx' app_secret: 'yyy' request_format: 'json' # Default response_format: 'array' # Default http_client: 'httplug.client' # Service ID for an object implementing Http\Client\HttpClient http_message_factory: 'httplug.message_factory' # Service ID for an object implementing Http\Message\MessageFactory
$linkedin = $this->get('happyr.linkedin'); $user = $linkedin->get('v1/people/~:(firstName,lastName)');
更多信息请查看库仓库: https://github.com/Happyr/LinkedIn-API-client
身份验证
实现 LinkedIn 身份验证最简单的方法是使用 Symfony 的 Guard 组件。