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

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

PHPz
PHPzOriginal
2016-06-06 20:31:381887browse

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

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

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

问题:

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

我需要这个依赖,但是不想用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
    }
}
?>

推荐教程:《composer

Statement:
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