G
G
genesis11112019-09-22 15:22:29
Composer
genesis1111, 2019-09-22 15:22:29

Please explain about Composer, how to work with it?

Hello!
Found the code on hithub
0. downloaded (insta desktop)
1. installed php (C:/composer)
2. installed composer (C:/php)
3. registered in cmd - composer require mgp25/instagram-php
everything was installed. What to do next is not clear
The instruction contains this:
require __DIR__.'/../vendor/autoload.php';
$ig = new \InstagramAPI\Instagram();
where to prescribe it - did not understand.
Please tell me how to work with this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Neverov, 2019-09-22
@genezis1111

The composer works simply: it aggregates all files with all classes and includes them into 1 file, which you must include for yourself. Further, all classes, methods, variables, etc. from installed libraries become available to you in your script after you include autoload.php .
autoload.php - this is the file where the composer connects the rest of the scripts. It lies in the vendor folder next to the installed composer.
So write:

require_one __DIR__.'/vendor/autoload.php';
$ig = new \InstagramAPI\Instagram(); //переменной можно пользоваться

This is if you have a script in the same folder as the composer.

F
FanatPHP, 2019-09-22
@FanatPHP

In your script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question