I’m trying to get a trivial example of aspose cloud SDK for PHP working… and clearly I’m missing something big.
I’ve used composer to install Aspose cloud-sdk-php, and in the vendor directory I can see aspose, composer, psr & symfony and autoload.
I then copied the first few lines from the example “Create an Empty Excel Workbook” (http://www.aspose.com/docs/display/cellscloud/Create+an+Empty+Excel+Workbook), so my code looks like:
<?php
$autoloadFile = ‘vendor/autoload.php’;
if (!file_exists($autoloadFile)) {
throw new RuntimeException(‘Install dependencies to run test suite.’);
}
require_once $autoloadFile;
use Aspose\Cells\CellsApi;
use Aspose\Cells\APIClient;
use Aspose\Storage\StorageApi;
$storageApi = new StorageApi();
$cellsApi = new CellsApi();
$apiClient = new APIClient();
When I run this, I get an error
Fatal error: Class ‘Aspose\Storage\StorageApi’ not found in /var/www/emi/testaspose/asposetest.php on line 15
Clearly I’m missing something incredibly obvious… (And also, using the SDK where do I set my api key?)
Appreciate the help…
Hi Ken,
Thank you for contacting Aspose support.
First of all, please note that the mentioned fatal error is caused due to the reason that you are missing the Aspose.Storage SDK for PHP. It would be appropriate that you should also freshly acquire the Aspose.Cells SDK for PHP. Regarding your second question, you may set the appSID & apiKey in AsposeApp.php available at src/aspose/cells.
Thanks, I’ll look into that. But here is what confused me…
On the Available SKDs page (http://www.aspose.com/docs/display/cellscloud/Available+SDKs) for PHP it points to a completely different PHP SDK with a completely different API.
As far as I can tell, the API you pointed me to is not linked from the main ASPOSE site.
K
Hi Ken,
Thank you for writing back.
Please note, the aforementioned page has two sections where first section lists the updates/latest SDKs whereas the second section list the outdated SDKs. If you click the GitHub link under Aspose.Cells Cloud SDK for PHP, it points to the same repository (Aspose.Cells Cloud SDK for PHP - v1.0.0) I have shared earlier with you.
The page version that was showing up as of yesterday in the US only had one PHP SDK and it was NOT marked as "outdated". The page seems to have been updated around the time of your message. I've attached a copy of the page as it was when I posted my message. It looks like it was a documentation issue.
Hi Ken,
I believe you are correct as the page revision shows that the page was updated on 11th February 2016 (possibly during the time of our conversation). Please note, we have recently revamped all SDKs and the said page was to be updated with links to new repositories.
Please accept our apologies for the inconvenience caused.
I’ve downloaded the SDK using the new link, and I don’t think the code that’s posted on github is correct. The vendor directory that should include all of the required files, doesn’t include cells and the dependencies for the autoloader do not appear to be correct.
Can anyone confirm that this is really working for them? And if so, any assistance would be appreciated.
Ken
Hi Ken,
Thank you for contacting Aspose support.
First of all, please note that we have tested the SDK by downloading it again from the previous shared link and we have not faced any difficulty. Regarding your concerns about vendor folder, it contains the dependency of the Cells SDK which is storage SDK whereas the code for the Cells reside in src folder at \src\Aspose\Cells. All you need to do is to set the AppSID and ApiKey in the following files.
- \src\Aspose\Cells\AsposeApp.php
- \vendor\aspose\storage-sdk-php\src\Aspose\Storage\AsposeApp.php
For your convenience I have also attached a sample PHP file (in an archive) demonstrating the usage. Please place it in the root folder of the SDK (where src & vendor folders reside) and execute it after setting the AppSID and ApiKey as discussed above.
As an update, kindly note the since Aspose.Cells Cloud 19.9 it has its own API methods to work with cloud storage. So there is no need to use Aspose.Storage Cloud anymore. Please let us know if you need any assistance in this regard.