Search code examples
composer-phpadminer

How to use adminer with composer autoload.php?


Earlier I downloaded the adminer from official site and used it like this "site.com/adminer.php", but now i installed the adminer via composer like dependence. How a can get access to adminer now?


Solution

  • Composer will fetch Adminer into the vendor folder of your project, e.g. your_project_folder/vendor/vrana/adminer.

    Keep in mind that you are working with the development version of Adminer, when you fetched it via Composer. That means it's a "multi-file application" and not the "single file version". Actually, there are "multiple-applications" inside this repository, e.g. editor, adminer.

    Adminer Webinterface

    Inside that folder you will find several other folders, including /adminer and /editor, each of them having a index.php file.

    You might directly start Adminer in your Browser by using the URL to its vendor folder, e.g. http://localhost/your_project_folder/vendor/vrana/adminer/adminer/index.php

    Same for the Editor, e.g http://localhost/your_project_folder/vendor/vrana/adminer/editor/index.php

    Note: You can't expect that Adminer works as an integrated version of CMS X or Framework Y out-of-the-box. There are plugins or bundles for some systems, e.g. for Laravel: kohkimakimoto/laravel-adminer.

    Compiling Adminer

    You may "compile" Adminer into a single file by using the file compile.php from the root folder. It accepts arguments for the driver and language. This replaces relative paths and creates the "single file version" based on the current checkout.

    Autoloading

    Autoloading is only needed, if you want to work on Adminer or use its API (use its classes in your project). Then you might simply include the Composer Autoloader: /vendor/autoload.php during the bootstrap of your project. This step is not needed, if you just want to run Adminers webinterface.