Answer the question
In order to leave comments, you need to log in
Composer autoload fails to find the class. What could be wrong?
Connected two libraries phpQuery and CURL. Everything is ok with the first one, but CURL does not want to be loaded automatically.
Here is what I have in my code:
<?php
require_once __DIR__ . '/vendor/autoload.php';
$pageText = new Curl();
$page = $pageText->get_page(URL);
$cat_page = phpQuery::newDocument($page);
{
"require": {
"electrolinux/phpquery": "^0.9.6",
"curl/curl": "^1.8"
}
}
Answer the question
In order to leave comments, you need to log in
Don't forget that classes can have a namespace:
<?php
require_once __DIR__ . '/vendor/autoload.php';
$pageText = new Curl\Curl();
$page = $pageText->get_page(URL);
$cat_page = phpQuery::newDocument($page);
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Curl\Curl;
$pageText = new Curl();
$page = $pageText->get_page(URL);
$cat_page = phpQuery::newDocument($page);
Judging by the code namespace is not specified. See which one is used in the Curl library.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question