Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Loading external library

How to load external library inside phalcon php code ? For example, I want to use HTTPFUL library from http://phphttpclient.com/ inside phalcon php application

The easiest way is to include it in your bootstrap file in your DI container. You can include an external library and instantiate it just like you do with the DB connection or Volt.



84.4k
Accepted
answer

According to the library documentation, you can use:

1) A Phar file:

<?php
// Point to where you downloaded the phar
include './httpful.phar';

// And you're ready to go!
$response = \Httpful\Request::get('http://example.com')->send();
...

or

2) Composer:

{
    "require": {
        "nategood/httpful": "*"
    }
}

Check how dependencies are loaded using Composer in Vokuro:



14.9k

Thanks for the help. Anyway I am trying the code.