2

I have tried doing all the above answers for namespaces, but it didn't worked so I thought to ask it again to get a solution. Now this is how I ideally used it in my Core PHP, it works perfect.

<?php
namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Firefox\FirefoxProfile;
use Facebook\WebDriver\Firefox\FirefoxDriver; 
use Facebook\WebDriver\Remote\LocalFileDetector; 
require_once('vendor/autoload.php');


$browser_name  = $_POST['browser_name'];

I need samething in Codeigniter As I have mentioned above I have downloaded the libraries files in third_party folder and I am using it like this,

<?php
namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Firefox\FirefoxProfile;
use Facebook\WebDriver\Firefox\FirefoxDriver; 
use Facebook\WebDriver\Remote\LocalFileDetector;


class Webservice_controller extends CI_Controller 
{
    public function __construct() 
    {
        parent::__construct();
        require_once(APPPATH.'third_party/vendor/autoload.php');
    }

Still it throws me this error:

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
    <h4>A PHP Error was encountered</h4>
    <p>Severity: Warning</p>
    <p>Message:  require(/var/www/html/mpdriver/application/libraries/Facebook/WebDriver/CI_Controller.php): failed to open stream: No such file or directory</p>
    <p>Filename: config/config.php</p>
    <p>Line Number: 538</p>
    <p>Backtrace:</p>
    <p style="margin-left:10px">
            File: /var/www/html/mpdriver/application/config/config.php
        <br />
            Line: 538
        <br />
            Function: _error_handler
    </p>

Any Solution to use namespaces in Codeigniter?

Jaymin
  • 1,643
  • 1
  • 18
  • 39
  • Possible duplicate of [What are namespaces?](https://stackoverflow.com/questions/3384204/what-are-namespaces) – Tomasz Aug 08 '17 at 07:38
  • @TomaszTurkowski I have tried doing the same but didn't worked so I though to ask again. :) – Jaymin Aug 08 '17 at 07:41
  • Use Composer instead. Check [this answer](https://stackoverflow.com/questions/38813987/integrating-mailjet-api-v3-wrapper-as-codeigniter-library/38815612#38815612) that could point you to right track. – Tpojka Aug 08 '17 at 07:52
  • Although not ready for production, check out the CodeIgniter 4 Beta https://github.com/bcit-ci/CodeIgniter4 – Nick Aug 09 '17 at 04:47

0 Answers0