如何设置从Git存储库提取的Laravel / Lumen项目(使用作曲家)?

时间:2019-02-04 22:20:56

标签: php mongodb laravel composer-php lumen

我是Laravel的新手,我从git repo中撤出了一个项目。 .gitIgnore文件包含:

/vendor
/.idea
Homestead.json
Homestead.yaml
.env

我看到我的项目无法正常工作。这实际上是一个使用流明的后端,并且所设置的路由即使已设置也无法通过localhost:8080/myRouteName访问

$router->group(['prefix' => 'myRouteName'], function () use ($router) {
    $router->post('/', ['middleware' => 'auth', 'uses' => 'MyController@store']);
});

因此,我猜我将需要/vendor文件夹,因为我认为该应用程序才能正常运行。我浏览了项目目录并运行命令:composer install,最后得到了this error

PS C:\wamp64\www\myprojectname> composer install
  [Composer\Exception\NoSslException]
  The openssl extension is required for SSL/TLS protection but is not available. 
If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.
    install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

然后我打开了WAMP目录,但找不到php.ini(php7.3.1,并且在Windows用户环境变量中进行了设置),因为我只看到php-development.ini和{{1} }。

所以我结束了命令:

php-production.ini

然后再次运行composer config -g -- disable-tls true ,我得到了these errors

composer install

尝试取消注释(在PS C:\wamp64\www\myprojectname> composer install You are running Composer with SSL/TLS protection disabled. Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for illuminate/encryption v5.6.15 -> satisfiable by illuminate/encryption[v5.6.15]. - illuminate/encryption v5.6.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. Problem 2 - Installation request for illuminate/support v5.6.15 -> satisfiable by illuminate/support[v5.6.15]. - illuminate/support v5.6.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. Problem 3 - Installation request for mongodb/mongodb 1.3.1 -> satisfiable by mongodb/mongodb[1.3.1]. - mongodb/mongodb 1.3.1 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system. Problem 4 - Installation request for phpunit/phpunit 7.0.3 -> satisfiable by phpunit/phpunit[7.0.3]. - phpunit/phpunit 7.0.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. Problem 5 - illuminate/support v5.6.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. - laravel/lumen-framework v5.6.3 requires illuminate/support 5.6.* -> satisfiable by illuminate/support[v5.6.15]. - Installation request for laravel/lumen-framework v5.6.3 -> satisfiable by laravel/lumen-framework[v5.6.3]. php-development.ini中),例如:

php-production.ini

但是这对错误没有帮助。 我的extension=openssl extension=mbstring 文件看起来像:

composer.json

所以基本上我不确定如何设置一个从{ "name": "laravel/lumen", "description": "The Laravel Lumen Framework.", "keywords": ["framework", "laravel", "lumen"], "license": "MIT", "type": "project", "require": { "php": ">=7.1.3", "google/apiclient": "^2.0", "jenssegers/mongodb": "^3.4", "laravel/lumen-framework": "5.6.*", "league/fractal": "^0.17.0", "vlucas/phpdotenv": "~2.2" }, "require-dev": { "fzaninotto/faker": "~1.4", "phpunit/phpunit": "~7.0", "mockery/mockery": "~1.0" }, "autoload": { "psr-4": { "App\\": "app/" } }, "autoload-dev": { "classmap": [ "tests/", "database/" ] }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true }, "minimum-stability": "dev", "prefer-stable": true } 仓库中提取的基本Laravel/Lumen应用程序。

1 个答案:

答案 0 :(得分:0)

Lumen需要在您的PHP ini文件中启用以下PHP扩展。

OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension

https://lumen.laravel.com/docs/5.7

为了使用WAMP编辑正确的php.ini文件,您必须右键单击任务栏中的wamp图标,转到PHP,然后单击php.ini。

在此文件中,您应该取消注释这两个扩展名。

extension=openssl
extension=mbstring