dtmwnqng38644
2018-10-01 23:15
浏览 173
已采纳

为什么我不能使用PHP Carbon库而不使用composer安装?

So i have tried to simply include Carbon into my project by simply requiring the autoload.php file in the Carbon package, but then it tells me "symfony/polyfill-ctype/bootstrap.php failed to open stream". OK, so i downloaded the folder from symphony and that error disappears, but then there are other folders / files that it requires, some of which i cannot find on the web.

It is strange that it's not in the Carbon package in the first place!

So i am using PHP version 7.1 I downloaded the Carbon package from https://github.com/briannesbitt/Carbon/releases I followed the instruction on https://carbon.nesbot.com/ under the 'Direct download' tab I have tried a lot of different versions of Carbon, current and older I have zero idea why it is not allowing me to use it...

All i want is to use Carbon and install it in the traditional (outdated) way of including libraries.

I know using composer is a lot better, but do not want to get into the reasons of why i cannot use it in this thread please :)

Any help would be much appreciated

Guys i have very little knowledge of composer and dependencies, this may be the issue i am having...

图片转代码服务由CSDN问答提供 功能建议

所以我试图通过简单地要求Carbon包中的autoload.php文件将Carbon包含到我的项目中, 但后来它告诉我“symfony / polyfill-ctype / bootstrap.php无法打开流”。 好的,所以我从symphony下载了该文件夹并且该错误消失了,但是还有其他文件夹/文件需要,其中一些我在网上找不到。

很奇怪 首先它不在Carbon包中!

所以我使用PHP版本7.1 我从 https://github.com/briannesbitt/Carbon/releases 我按照 https://carbon.nesbot.com/ 在”直接下载“标签下 我尝试了很多不同版本的Carbon,当前和更老版本 我没有想法 为什么它不允许我使用它...

我想要的只是使用Carbon并以包含库的传统(过时)方式安装它。

我知道使用composer要好很多,但是不想深入了解为什么我不能在这个帖子中使用它的原因请:)

任何帮助都会非常感激

大家我对作曲家和依赖关系知之甚少,这可能是我遇到的问题......

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doujing5846 2018-10-01 23:45
    已采纳

    Carbon really requires Composer at this point as it relies on dependencies. I would definitely take the time to learn and use Composer, it's great! You don't necessarily need it installed on the server provided you upload the files that Composer downloads for you in your local development environment.

    With that said, you could use an old version (1.17.0) that will allow you to use it as a stand-alone with no dependencies though I wouldn't recommend it.

    Download this Carbon file from the repo and save it as carbon.php.

    Inside any of your PHP files:

    <?php 
    
    require 'your/path/to/carbon.php';
    use Carbon\Carbon;
    
    //Use Carbon
    
    echo "Now: " . Carbon::now();
    
    打赏 评论

相关推荐 更多相似问题