Home > Backend Development > PHP Tutorial > 可以不通过composer来使用依赖吗

可以不通过composer来使用依赖吗

PHPz
Release: 2020-09-05 13:33:26
Original
1912 people have browsed it

可以不通过composer来使用依赖,其实现方法就是通过“include”方法手动加载相关依赖即可,具体代码语法为“include "NotORM.php";”。

可以不通过composer来使用依赖吗

可以不通过composer来使用依赖吗?

问题:

"require": {
    "vrana/notorm": "dev-master"
},
Copy after login

我需要这个依赖,但是不想用composer怎么让他自动加载,能够正常使用

方法:

直接下载 https://github.com/vrana/notorm

根据手册一步一步来。

不自动加载,只能手动加载了,就是 include

<?php
include "NotORM.php";
$connection = new PDO("mysql:dbname=software");
$software = new NotORM($connection);
foreach ($software->application()->order("title") as $application) { // get all applications ordered by title
    echo "$application[title]\n"; // print application title
    echo $application->author["name"] . "\n"; // print name of the application author
    foreach ($application->application_tag() as $application_tag) { // get all tags of $application
        echo $application_tag->tag["name"] . "\n"; // print the tag name
    }
}
?>
Copy after login

推荐教程:《composer

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template