composer-php

Laravel: array_merge(): Argument #2 is not an array error

依然范特西╮ 提交于 2020-01-01 01:16:14
问题 Exceptions started to appear in all views, and when I try to run composer update , it always ends up with {"error":{"type":"ErrorException","message":"array_merge(): Argument #2 is not an array","file":"\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":188}} 回答1: After a lot of searching and exploring each file in the 'app' folder, it appears that one file was corrupt Delete app/storage/meta/ services.json and re-run composer update and this should solve it.

Composer autoload full example?

一个人想着一个人 提交于 2019-12-31 16:33:17
问题 I am trying to put all the peaces together I found about autoloading a class in composer but I can't make it work. Every example I see is missing some part. Basically it comes down to two files with 4 lines: index.php $loader = require 'vendor/autoload.php'; $loader->add('Vendor\\', __DIR__.'/../app/'); new Vendor_Package_Obj(); app/Vendor/Package/Obj.php class Obj {} I also tried psr-4 and all thinkable combinations of folders and names for `Vendor Package Obj? but no luck finding a working

Where to register autoload when the vendor is not managed with composer in Symfony 2.1?

孤人 提交于 2019-12-31 12:56:52
问题 I'm using symfony 2.1 and I want to add a library to vendors. The library do not exists in packagist. I can't manage it with composer. When I install bundles or others vendors through composer, it manage autoload for me. But where to register autoload when the vendor is not managed with composer? 回答1: You can add libraries to composer that are not in packagist. You must add them in the repositories array of your composer.json file. Here's how to load a github repository that has a composer

installing laravel --prefer-dist

不羁的心 提交于 2019-12-31 08:57:06
问题 I am following the Laravel installation on their website and I came across this line composer create-project laravel/laravel --prefer-dist Now, what exactly does the --prefer-dist part mean? I can't see anything on their documentation. Thanks in advance. 回答1: It's all available here: https://getcomposer.org/doc/03-cli.md#install --prefer-dist: Reverse of --prefer-source, composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases

Project Structure with composer

自闭症网瘾萝莉.ら 提交于 2019-12-31 07:25:09
问题 I'm trying to create a project with composer-file. Reason is primarily a dependency which I never want to upload to git. My intended structure is this: project-root-folder - project-sub-folder(s) - vendor (with require d dependencies) - index.php - composer.json - README.md But the installed structure using composer is this: project-root-folder - vendor - vendor/composer - vendor/smarty (dependency) - vendor/my-project - composer.json I know that there are special installers for many

Can't install composer due to certificate issues

自古美人都是妖i 提交于 2019-12-30 17:39:47
问题 So I have tried all morning to install composer so I can start to use the laravel framework. I am running windows server r2 standard 64bit with XAMPP on php 7.0 When running the Composer-Setup.exe I get the following message.. The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed Failed to enable crypto failed to open stream: operation

Composer Autoloading

不羁的心 提交于 2019-12-30 17:25:09
问题 I'm currently trying to use PSR-0 autoloading with Composer, but I'm getting the following error: Fatal error: Class 'Twitter\Twitter' not found My directory structure looks like this - Project - src - Twitter Twitter.php - vendor - Test index.php My index.php file looks like this: <?php use Twitter; $twitter = new Twitter(); My Twitter.php file looks like this <?php namespace Twitter; class Twitter { public function __construct() { // Code Here } } And finally my composer.json looks like

Patchwork\Utf8\Bootup causing problems with Laravel 4

自古美人都是妖i 提交于 2019-12-30 09:00:14
问题 My project has been working fine until recently, when I ran sudo composer self-update . Composer successfully updated but I could no longer migrate ( php artisan migrate ). This is the error I get: PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in /Applications/MAMP/htdocs/ThumbsUp/bootstrap/autoload.php on line 46 I have ran composer update and composer install , and still this error persists. Why would it not be finding this class after the self-update ? 回答1: I had the same

Custom helper classes in Laravel 5.4

≯℡__Kan透↙ 提交于 2019-12-30 08:05:32
问题 I have some helper classes in app/Helpers . How do I load these classes using a service provider to use them in blade templates? e.g. If I have a class CustomHelper that contains a method fooBar() : <?php nampespace App\Helpers; class CustomHelper { static function fooBar() { return 'it works!'; } } I want to be able to do something like this in my blade templates: {{ fooBar() }} instead of doing this: {{ \App\Helpers\CustomHelper::fooBar() }} P.S: @andrew-brown's answer in Best practices for

how to run composer.phar self-update in travis

 ̄綄美尐妖づ 提交于 2019-12-30 04:05:05
问题 I am facing warning statements in my travis builds. Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/home/travis/.phpenv/versions/5.3.26/bin/composer.phar self-update" to get the latest version. How do I then run this? See an e.g. here 回答1: It is not such a good idea to hard-code the php path as paths might change when Travis gets update. I suggest simply calling composer self-update 回答2: inside your travis.yml make sure you have