Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 410 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php - Class not found (composer.json)

#1
I'm trying to implement [a PHP Library for detecting CMS][1] I found on github, but I can't for the life of me figure it out.

I am new to php and composer, but I installed composer in my directory, then updated the json as instructed, but it cannot find the classes, despite them all being in the directory.

running this code

include(__DIR__ . "/vendor/autoload.php");
$domain = "http://google.com";
$cms = new DetectCMS($domain);
if($cms->getResult()) {
echo "Detected CMS: ".$cms->getResult();
} else {
echo "CMS couldn't be detected";
}

gives me this error

PHP Fatal error: Uncaught Error: Class 'DetectCMS' not found in D:\Projects\Scraper\ccc.php:12
Stack trace:
#0 {main}
thrown in D:\Projects\Scraper\ccc.php on line 12

here is my file structure:

[![File structure][2]][2]

would anyone have any idea what I'm doing wrong with this information?
Thanks in advance

[1]:

[To see links please register here]

[2]:
Reply

#2
I think to include a class using the autoloader,in your class, you must do something about it:


in your composer.json

"autoload": {
"psr-4" :{"DetectCMS": "DetectCMS"}
}
after in your class DetectCMS.php:

<?php
use DetectCMS\DetectCMS;

or

<?php

$loader = require 'vendor/autoload.php';
$loader->add('DetectCMS', __DIR__.'DetectCMS');

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through