0

Right now, I am studying migration from 2.x to Version 3 of CakePHP.
I have developed a simple sending of sms using GlobeLabs API (one of available SMS Gateway in the Philippines).
https://github.com/globelabs/api

Right now, I know what's the essence of composer and unfortunately, there are no hosted or uploaded package of Globelabs API in the packagist and I believe that App::import("Vendor","filepath") are now deprecated and not supported in the new version.

How can I utilize GlobeAPI in CakePHP 3?
I will appreciate any answer.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
bowmeow
  • 109
  • 1
  • 11

1 Answers1

0

Put the lib somewhere and define a path for the autoloader in your apps composer.json:

"autoload": {
    "psr-4": {
        "App\\": "src",
        "Your\\Lib\\": "./some/path/to/your/lib/src"
    }
},

It will tell composer to look in that folder when loading something from your libs namespace.

floriank
  • 25,546
  • 9
  • 42
  • 66
  • 2
    An run `composer dumpautoload` after that – José Lorenzo Rodríguez Apr 13 '15 at 08:30
  • should I put this autoload in the composer.json found in the root file of cakephp 3? – bowmeow Apr 13 '15 at 08:44
  • The root folder of your cake3 application. If you don't know how to work with composer I highly recommend you to become familiar with it. Composer is a *very* common tool for php development these days. Almost every project provides composer support. – floriank Apr 13 '15 at 09:40
  • Yep. Actually, I am new in composer and I've already know what's the essence of it in the production. I have already utilized the GlobeAPI by including and declaring the exact path of the said API in the autoload_classmap.php under the composer folder in the vendor folder of cakephp 3. I've already tested of calling the class of GlobeAPI in the view, however what I want to do is to call the class of GlobeAPI to the controller. Is there a way to call the class of the said API to the controller? Thanks – bowmeow Apr 14 '15 at 03:47