Welcome Guest, Not a member yet? Register   Sign In
Installed class via composer, need help using.
#1

I installed https://github.com/phpWhois/phpWhois through composer and turned on the autoload feature, but I can't figure out usage based on the documentation.

It is installed in the app/vendor/phpwhois folder.

Can someone point me in the right direction?
Reply
#2

Set $config['composer_autoload'] to TRUE or a custom path in application/config/config.php and then just follow the directions. Super simple.
Reply
#3

(This post was last modified: 01-21-2017, 11:13 AM by enlivenapp. Edit Reason: formatting fail )

(01-19-2017, 03:09 PM)merger Wrote: I installed https://github.com/phpWhois/phpWhois through composer and turned on the autoload feature, but I can't figure out usage based on the documentation.

It is installed in the app/vendor/phpwhois folder.

Can someone point me in the right direction?

The README for the repo has good examples,  the CI specific part not included is where it's a little confusing for new folks.   basically you can use it in any controller or model...  Below should get you started.


In a CI3 controller (models are basically the same):

PHP Code:
<?php

class Example extends CI_Controller
{

 
   public function getWhois() 
 
   {

 
      use phpWhois\Whois;

 
      $whois = new Whois();
 
      $query 'example.com';
       $result $whois->lookup($query,false);
 
      echo "<pre>";
 
      print_r($result);
 
      echo "</pre>";
 
   }

Reply




Theme © iAndrew 2016 - Forum software by © MyBB