I used composer to download a php bitcoin library to play around with. https://github.com/phramz/php-bitcoin-api
This one specifically.
Anyways, everytime I try to use the library with
use Phramz\Bitcoin\Api\Connection\BuzzConnection;
use Phramz\Bitcoin\Api\BitcoindClient;
I get
Interface 'Phramz\Bitcoin\Api\Client' not found in
/root/vendor/phramz/php-bitcoin-api/src/Phramz/Bitcoin/Api/BitcoindClient.php
whenever I try to run any test code. I really want to play around with this library but Im sort of a newbie php programmer and this is frustrating me. Any help would be appreciated!
Make sure you require vendor/autoload.php as described in Composer documentation.
If Composer's vendor directory is not located in the current directory you'll need to use an absolute path or something like:
<?php
require_once(__DIR__."/../../vendor/autoload.php");
I had the kind of issue when I installed a new lib, and i just deployed the new lib to server only as I was new to PHP, it took me hours to figure out that the vendor/composer folder is updated when we install a new lib.
So if your server doesn't support composer install , upload the whole vendor folder to your server is the way.
Related
I found a PHP caching library that I'd like to use in CodeIgniter, but the docs only have instructions for installing / using with composer: http://www.php-cache.com/en/latest/
I inherited a project on a server that doesn't have Composer. Ideally I would like to use it without Composer. Does anyone have any knowledge of how to load this without it?
well, you could download the package itself and add it to your Codeignitter libraries autoload (if that's possible, sorry, dont know too much of CodeIgnitter). Though if i'd be you i'd go into Composer, it is revolutionary for php apps and you're loosing out so much by not using it... just composer init in main app folder & make sure that your CI is reading the autoloaded classes (i bet you'll find some tutorial for that)
by download I mean download and require in your php files where you're using it!
I'm trying to use the Plivo PHP helper library in my project, but looks like the only way to use it is with Composer. Is there any work around for this since I cannot use composer in my project as it would change the existing code?
Plivo Sales Engineer here.
Unfortunately, Plivo-PHP helper library can be used only with Composer. If installing the library with Composer is not feasible, you could download and install the dependencies individually and include the libraries in your project. Or, you could also make HTTP requests to the API directly without using the helper library. You could use cURL or Requests library to make these requests.
I had a similar issue.
The access to the server was very limited, I had only FTP access, I could have waited to ask for SSH access to do the install using composer I simply installed Composer on my local machine and then just had to run
composer require plivo/php-sdk
In an empty directory. It created the SDK files under /vendor and I uploaded those files through FTP to the server. Did the job for me.
I need to use XML-RPC on my project. I have found a library phpxmlrpc (http://phpxmlrpc.sourceforge.net/) and I need to add it to vendor. I have copied the files in vendor folder (/vendor/phpxmlrpc/) and I need to see the xmlrpc_client class in my Controller. But I am not able to manage how to edit autoload.php to see the class, after a few attemps I am still getting "Attempted to load class "xmlrpc_client" from the global namespace.
Did you forget a "use" statement?" so I am pretty sure that there is some mess in my structure. I would really appreciate any help.
You must use a composer install tools for integrate 3third party code in your project a lot of possible time.
For XML-RPC you have this bundle : Symfony-rpc-bundle
When you install with composer install your bundle a lot of tricks run in your project symfony. Don't forget to add this bundle in your AppKernel.php file.
With this your code for XML-RPC is more upkeeping and stable.
A bit late with the answer, I fear, but phpxmlrpc can now be installed using Composer as you would do with any other package.
When checking out info about that library, just make sure that you look up the latest version on GitHub and not any more on SourceForge.
im having a really big problem understanding the usage of composer and frameworks.
The tutorials i have seen use some kind of online-editor so they dont really help me.
I learned about OOP etc and now i want to do the next step and learn about frameworks and composer.
I have a server and already managed to install composer. Plus i managed to install packages.
But what now? Can you tell me at a very basic level how to make use of this stuff?
I have an editor on my notebook and installed composer on my server. How do I interact with the classes?
Do i just write them and upload the file to check if it works? Do i somehow install them on my local environment? And if yes, how would i deploy my project afterwards?
I know its much but im not getting the basics of usage here :(
Thank you very much!
I watched tutorial for hours now but they always just seem to use the stuff. And i dont know how.
What you have to understand is that Composer is only a package manager, it will allow you to download some libraries (and their dependencies), and provide you an autoloader file to include on your files, so that you can use library classes.
Actually, you better install Composer on your local machine, develop your website locally, then, when it's ready, deploy it to your server.
A simple example, supposing you want to use Silex microframework.
Install Silex with composer
composer require 'silex/silex:1.3.0'
Include Silex in your script
Including Composer autoloader file
<?php
require_once './vendor/autoload.php';
$app = new Silex\Application();
?>
Develop
It's up to you, test it locally with a webserver installed on your computer.
Deploy
Deploy your website by pushing it on your webserver (with a FTP client for example).
I am currently trying to install Omnipay into my Codeigniter project. I am stuck on windows because I do not have ssh access to the box where this needs to run on. So far I have gotten a new directory in the project root that is named "vendor" and it contains a lot of empty directories referring to Symfony (for what reason is beyond me).
Then I get a runtime exception that I need to enable the openssl extension in my php to download the necessary files and this is where I am stuck at. I don't run WAMP on my computer and I just use the php.exe I downloaded to work with netbeans.
Isn't there an easier way to get omnipay to run? Like just download the files from somewhere and plug them into my project like normal? It seems to be an aweful lot of headache to get a simple library to run in my CI project.
Please forgive my ignorance towards composer but I currently see no benefit of using it for this particular project.
You can "just download" the files here: https://github.com/omnipay/common/archive/master.zip
The problem is, Omnipay depends on Guzzle (an HTTP library), and Guzzle depends on some Symfony components. So you will spend the rest of the day downloading dependencies and making sure you have all the necessary files. That is the problem Composer solves for you.
I don't have any experience running Composer on Windows, but I would start here:
http://getcomposer.org/doc/00-intro.md#installation-windows
Using the Installer
This is the easiest way to get Composer set up on your machine.
Download and run Composer-Setup.exe, it will install the latest
Composer version and set up your PATH so that you can just call
composer from any directory in your command line.
Once you have Composer installed, you should simply be able to make a file named composer.json in your project root, with the following contents:
{
"require": {
"omnipay/omnipay": "~2.0"
}
}
Then use the Command Prompt and cd to your project's directory, and run composer update to download the Omnipay files and all their dependencies.