首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Laravel-5.1地理名称,使用Composer克隆存储库

Laravel-5.1地理名称,使用Composer克隆存储库
EN

Stack Overflow用户
提问于 2016-01-02 10:20:47
回答 2查看 461关注 0票数 0

我想用地名作为网站上的地址。我正在用Laravel5.1开发它。我发现这个教程作为入门教程很有用:为Geonames

由于版本不兼容,我联系了该项目的一位同事,他重定向我使用他的存储库:我和Javier Martinz关于L-5.1兼容更新的谈话。简单的解决方案是添加他的存储库,这是我在composer.json中所做的。在运行此命令之后,我希望看到库被克隆,并为geonames使用artisan命令,让我感到惊讶的是,这一点都不算什么。我没有使用像git这样的版本控制,只是在本地存储。

如何克隆存储库?我已经给他写信了,但暂时没有回复。我想他放假了。

这是我的composer.json文件

代码语言:javascript
运行
复制
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "laravelcollective/html": "5.1.*",
        "laravel/socialite": "^2.0",
        "toin0u/geocoder-laravel": "@stable",
        "ext-zip": "*",
        "illuminate/config": ">=5.1.0",
        "illuminate/console": ">=5.1.0",
        "illuminate/database": ">=5.1.0",
        "illuminate/filesystem": ">=5.1.0",
        "illuminate/support": ">=5.1.0",
        "symfony/process": "2.7.*",
        "guzzle/http": "^3.9",
        "guzzlehttp/guzzle": "~4.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/JavierMartinz/geonames"
        }
    ],    
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

这是我在添加:"ipalaus/geonames": "1.0.*"时遇到的错误

代码语言:javascript
运行
复制
C:\Users\ken4ward\Documents\xampp\htdocs\tradersmart>composer update
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing guzzlehttp/psr7 (1.2.1)
  - Removing psr/http-message (1.0)
  - Removing guzzlehttp/promises (1.0.3)
  - Installing guzzlehttp/streams (2.1.0)
    Downloading: 100%

  - Removing guzzlehttp/guzzle (6.1.1)
  - Installing guzzlehttp/guzzle (4.2.3)
    Downloading: 100%

  - Removing laravel/socialite (v2.0.14)
  - Installing laravel/socialite (v2.0.4)
    Downloading: 100%

Writing lock file
Generating autoload files
> php artisan optimize
Generating optimized class loader

C:\Users\ken4ward\Documents\xampp\htdocs\tradersmart>composer update
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - ipalaus/geonames v1.0.0 requires illuminate/config 4.2.* -> no matching pa
ckage found.
    - ipalaus/geonames v1.0.1 requires illuminate/config 4.2.* -> no matching pa
ckage found.
    - ipalaus/geonames v1.0.2 requires illuminate/config 4.2.* -> no matching pa
ckage found.
    - ipalaus/geonames v1.0.1 requires illuminate/config 4.2.* -> no matching pa
ckage found.
    - ipalaus/geonames v1.0.0 requires illuminate/config 4.2.* -> no matching pa
ckage found.
    - Installation request for ipalaus/geonames 1.0.* -> satisfiable by ipalaus/
geonames[v1.0.0, v1.0.1, v1.0.2].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your min
imum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further commo
n problems.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-10-22 22:02:42

我也试着使用ipalaus/geonames,但它不太好。它没有发挥作用,而我几个月前创建的发行票也没有得到回应。因此,我制作了我自己的包裹,它的导入速度远远快于ipalaus/geonames,而且已经更完整了。用ipalaus/geonames导入数据库花费了15个小时,我的包只需30分钟。

票数 2
EN

Stack Overflow用户

发布于 2016-01-02 13:20:20

一旦我看到您的composer.json,我想知道它是否只是将Git注册为一个可用的源代码,而不是具体地请求它作为一个依赖项。因此,我找到了执行了这个搜索这篇博客文章

为了总结这篇文章的内容,它说Git依赖项需要使用单词dev-,后面是您想要的分支名称(这通常是master,但可能会有所不同)。因此,在您的示例中,require JSON数组中的解决方案是:

代码语言:javascript
运行
复制
"ipalaus/geonames": "dev-master"

从拉请求的对话来看,您想要的更改似乎已经被合并了。因此,您现在应该能够按照这些说明删除Git:

对于Laravel 5.1 composer required ~2.0或Laravel 5.2 composer required ~3.0您应该能够要求v2.0

如果是这样的话,您现在可以使用Packagist版本了,不要觉得您的时间被浪费了--学习如何使用带有特殊需求(例如回购依赖项)的Composer确实是值得的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34564791

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档