简体   繁体   中英

Composer.json in a simple PHP

I knew this is so basic question but I completely have no idea how to deal with this. I have a single PHP page that contain a form and simple PHP code to insert form data to database.

Now I want to test a Composer based code Code Link

I just simply copy this entire code and try to run but it shows syntax error. Yes I already installed composer.json

charge-credit-card.php is the file that I just created as mention on github 在此处输入图片说明

My problem is not this code I want to learn how I run any Composer based code without any framework. Just simple way to test any code.

If you want to learn how to use Composer have a look at tutorials like this:
https://www.dev-metal.com/composer-tutorial/

The key is to require Composer's autoload.php in your own main project file (eg in your index.php ).

<?php

require 'vendor/autoload.php';

This loads the Composer autoloader. So this line includes everything that Composer has downloaded into the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM