diff --git a/DependencyInjection/Factory/PhpseclibSftpAdapterFactory.php b/DependencyInjection/Factory/PhpseclibSftpAdapterFactory.php new file mode 100644 index 0000000..5baf6ed --- /dev/null +++ b/DependencyInjection/Factory/PhpseclibSftpAdapterFactory.php @@ -0,0 +1,49 @@ +setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.phpseclib_sftp')) + ->addArgument(new Reference($config['phpseclib_sftp_id'])) + ->addArgument($config['directory']) + ->addArgument($config['create']) + ; + } + + /** + * {@inheritDoc} + */ + function getKey() + { + return 'phpseclib_sftp'; + } + + /** + * {@inheritDoc} + */ + function addConfiguration(NodeDefinition $builder) + { + $builder + ->children() + ->scalarNode('phpseclib_sftp_id')->isRequired()->end() + ->scalarNode('directory')->defaultNull()->end() + ->booleanNode('create')->defaultFalse()->end() + ->end() + ; + } +} diff --git a/README.markdown b/README.markdown index d4c49b6..2ef6e1b 100644 --- a/README.markdown +++ b/README.markdown @@ -375,6 +375,47 @@ services: arguments: [@acme_test.ssh.session] ``` +## Phpseclib Sftp (phpseclib_sftp) + +Adapter for phpseclib SFTP (SSH-FTP). + +### Parameters + + * `phpseclib_sftp_id` The id of the service that provides SFTP access. + * `directory` The remote directory *(default null)*. + * `create` Whether to create the directory if it does not exist *(default false)*. + +### Example + +``` yaml +# app/config/config.yml +knp_gaufrette: + adapters: + foo: + phpseclib_sftp: + phpseclib_sftp_id: acme_test.sftp + directory: /example/sftp + create: true +``` + +In your AcmeTestBundle, add following service definitions: + +``` yaml +# src/Acme/TestBundle/Resources/config/services.yml +parameters: + acme_test.ssh.host: my_host_name + acme_test.ssh.username: user_name + acme_test.ssh.password: some_secret + +services: + acme_test.sftp: + class: Net_SFTP + arguments: [%acme_test.ssh_host%] + calls: + - [login, [%acme_test.ssh.username%, %acme_test.ssh.password%]] + +``` + ## Apc (apc) Adapter for APC. diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 562a144..f7e6dbf 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -47,6 +47,9 @@ + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index 49041e4..d2f8808 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -40,6 +40,7 @@ +