PHP include class not working -


i'm trying use php class plugin on project. (windows)

https://github.com/mhor/php-mediainfo

it basic question don't know how make work.

my code:

<?php     include '/mediainfo/mediainfo.php';     $mediainfo = new mediainfo(); 

and error:

fatal error: class 'mediainfo' not found in index.php on line 15 

/mediainfo/mediainfo.php:

<?php  namespace mhor\mediainfo;  use mhor\mediainfo\builder\mediainfocommandbuilder; use mhor\mediainfo\container\mediainfocontainer; use mhor\mediainfo\parser\mediainfooutputparser;  class mediainfo {     /**      * @param $filepath      * @return mediainfocontainer      */     public function getinfo($filepath)     {         $mediainfocommandbuilder = new mediainfocommandbuilder();         $output = $mediainfocommandbuilder->buildmediainfocommandrunner($filepath)->run();          $mediainfooutputparser = new mediainfooutputparser();         $mediainfooutputparser->parse($output);          return $mediainfooutputparser->getmediainfocontainer();     } } 

i don't know 'mhor\mediainfo\'. downloaded source github , , extracted root www /mediainfo:

  • /
  • /index.php
  • /mediainfo/... (all files , folders)

i tried other class , same error.


after trying tanmay kumar' suggestion:

$mediainfo =  new \mhor\mediainfo\mediainfo(); 

the error fixed, next line:

$mediainfocontainer = $mediainfo->getinfo('video.mp4'); 

gives:

fatal error: class 'mhor\mediainfo\builder\mediainfocommandbuilder' not found 

here complete correct method:

include '/mediainfo/mediainfo.php'; use \mhor\mediainfo\mediainfo;//now can directly call class on it's name  $mediainfo = new mediainfo(); 

let me know if face anymore problems :)


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -