shubaivan / sh-cv-editor-bundle
Symfony2 Cv editor bundle
Requires
- php: >=5.3.3
- symfony/framework-bundle: v2.6.9
Suggests
This package is not auto-updated.
Last update: 2024-10-02 08:21:21 UTC
README
先决条件
此版本的包需要 Symfony 2.1。
翻译
如果您想使用此包中提供的默认文本,请确保您已在配置中启用了翻译器
# app/config/config.yml
framework:
translator: { fallback: en }
有关翻译的更多信息,请参阅 Symfony 文档。
安装
安装是一个快速的四步过程
- 下载 SkonsoftCvEditorBundle
- 启用 Bundle
- 配置您的应用配置文件 config.yml
- 更新您的数据库
步骤 1:安装 SkonsoftCvEditorBundle
安装此包的首选方法是依赖 Composer。只需在 Packagist 上检查您想要安装的版本(在下面的示例中,我们使用了 "dev-master"),并将其添加到您的 composer.json
{ "require": { // ... "skonsoft/cv-editor-bundle": "dev-master" } }
步骤 2:启用 Bundle
在 kernel 中启用 Bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Skonsoft\Bundle\CvEditorBundle\SkonsoftCvEditorBundle(), ); }
步骤 3:配置 config.yml
此 Bundle 需要一个服务提供程序,该程序将文档和 pdf 简历转换为我们的模型(Profile)。
SkonsoftCvEditorBundle 附带一个默认的服务提供程序:TextKernelProvider,它连接到 TextKernel 以解析简历。
因此,如果您想使用默认的 TextKernelProvider,您应该在 TextKernel 中拥有一个有效的账户。否则,您应该实现自己的提供程序。有关更多信息,请参阅自定义提供程序部分。
要指定您的提供程序,只需将其添加到 config.yml 中
#app/config/config.yml
#the provider to use
skonsoft_cv_editor:
provider_service_id: skonsoft_cv_editor.textkernel_provider
如果您拥有有效的 TextKernel 提供程序,您应该在 config.yml 中添加您的身份验证参数。因此,您的 config.yml 应该看起来像
#the provider to use
skonsoft_cv_editor:
provider_service_id: skonsoft_cv_editor.textkernel_provider
parameters:
skonsoft_cv_editor.textkernel_provider.username: Text_kernel_username
skonsoft_cv_editor.textkernel_provider.password: Text_kernel_password
skonsoft_cv_editor.textkernel_provider.account: Text_kernel_account
现在,只需更新您的数据库
步骤 3:更新数据库
./app/console doctrine:schema:update --force
现在,您可以通过 cv/profile/ 浏览简历,列出所有简历配置文件,您可以添加、上传和编辑简历。
构建自定义提供程序,
它非常简单,只需创建一个新的类,该类扩展了 Skonsoft\Bundle\CvEditorBundle\Provider\BaseProvider
您自己的新提供程序应实现继承的抽象方法
/**
* loads a document into CvProfile object
*
* @param string $document the path of document to load (doc, pdf)
* @return Skonsoft\Bundle\CvEditorBundle\Entity\CvProfile
*/
public function load($document){
// your logic here to parse the document and return a profile object (Skonsoft\Bundle\CvEditorBundle\Entity\CvProfile)
}
有关更多信息,请参阅 Skonsoft\Bundle\CvEditorBundle\Provider\TextKernelProvider 的实现方式。
现在,您的新提供程序类已准备好使用,因此您只需通过将其声明为服务来通知控制器使用它。
之后,只需用新服务替换默认服务
#app/config/config.yml
#the provider to use
skonsoft_cv_editor:
provider_service_id: skonsoft_cv_editor.custom_provider # the new created service
现在,试试吧!