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



我想在网站上使用地名作为地址。我正在使用Laravel 5.1开发它。我发现这是一个有用的入门教程:Ipalaus Laravel 4.*用于Geonames。

由于版本不兼容,我联系了该项目的一位同事,他重定向我使用他的存储库:我与Javier Martinz关于L-5.1兼容更新的对话。简单的解决方案是添加他的存储库,就像我在composer.json中所做的那样。在运行完这个之后,我本以为已经克隆了存储库,并为地理名称提供了artisan命令,但令我惊讶的是,这一点都没有。我没有使用像git这样的版本控制,只是在本地存储。

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

这是我的composer.json文件

{
    "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.*"

C:Usersken4wardDocumentsxampphtdocstradersmart>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:Usersken4wardDocumentsxampphtdocstradersmart>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.

我也尝试使用ipalaus/geonames,但效果不太好。它不起作用,我几个月前创建的问题票证也没有得到回应。所以我制作了自己的包,它的导入速度比ipalaus/geonames快得多,而且已经更完整了。导入ipalaus/geonames数据库花了15个小时,而我的包只花了30分钟。

一旦我看到您的composer.json,我想知道这是否只是将Git repo注册为可用源,而不是专门将其作为依赖项请求。因此,我进行了这次搜索,找到了这篇博客文章。

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

"ipalaus/geonames": "dev-master"

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

您应该能够要求2.0版本的Laravel 5.1 composer要求2.0或v3.0版本的Laravel 5.2 composer需要3.0

如果你现在可以使用Packagist版本,不要觉得你的时间被浪费了——学习如何使用有特殊需求的Composer(如回购依赖关系)确实是值得的。

相关内容

  • 没有找到相关文章

最新更新