Error when using composer require-dev.mikey179/vfsStream is invalid - codeigniter

I am using Amazon LightSail and the CodeIgniter framework. Trying to install PhpSpreadsheet - https://phpspreadsheet.readthedocs.io/en/latest/#installation using
composer require phpoffice/phpspreadsheet
However I then am greeted with
[RuntimeException]
require-dev.mikey179/vfsStream is invalid, it should not contain uppercase characters. Please use mikey179/vfsstream instead.
I did the usual Googling but couldn't find anything specific.
When I run
composer.phar show
I get the error from above.

You must have mikey179/vfsStream in your composer.json in require-dev section (as the problem is for require-dev and you are trying to do normal require).
Simply change the name of package to all lowercase characters.

Just replace mikey179/vfsStream with mikey179/vfsstream

Make this "mikey179/vfsStream" package name to lowercase.
"mikey179/vfsStream" replace this to "mikey179/vfsstream"

In your composer.json file look for mikey179/vfsStream and lowercase all its characters and make it mikey179/vfsstream
"require-dev": {
"mikey179/vfsstream": "1.1.*",
"phpunit/phpunit": "4.* || 5.*"
}

Related

Error trying to publish config file of laravel-livewire?

Reading laravel-livewire docs at
https://laravel-livewire.com/docs/2.x/installation
I tried to publish The Config File and I got unexpected results
$ php artisan livewire:publish
Command "livewire:publish" is not defined.
Did you mean one of these?
livewire:configure-s3-upload-cleanup
livewire:copy
livewire:delete
livewire:discover
livewire:make
livewire:move
livewire:stubs
stub:publish
sweetalert:publish
vendor:publish
Why so and which command have I use to to publish config file ?
I have :
"laravel/framework": "^7.0",
"livewire/livewire": "^1.3",
Thanks!
You have installed
"livewire/livewire": "^1.3",
and are referring to version 2 documentation
https://laravel-livewire.com/docs/2.x/installation
Use liverwire version 2 or version 1 documentation instead.
In case others wonder, the line "livewire/livewire": "^1.3" can be found in require section of the composer.json file in the project's root directory.

Laravel5.5 after use php artisan app:name Class not found

I am new developer on Laravel, now I'm using Laravel version 5.5
I got the problem after used php artisan app:name on my project, I got the problem:
In ProviderRepository.php line 208: Class
'App\Providers\AppServiceProvider' not found
as the captured image below:
As this error, I can not use php artisan commands or composer commands anymore can you guys please help me to solve this problem I am really appreciated for time. Thanks you
Best Regards
Siripong Gaewmaneechot
I would suggest looking in your config files, and the main classes which were generated when you started your laravel project (User class, etc) because they are all set to App\User App..... etc.
So for example, in the image you have in the question, it says it can not find App\AppProviders... - This indicates that somewhere you still have a use statement pointed to App\AppProviders.. but you changed the app name, so it's no longer App. something I do if I made that mistake, is I do a global search in my project files for App\ (you may need to put App\\ in the search because \ is an escape character
So if you did not change the app name immediately after starting the project, some of the paths will not be pointing to the correct directories. Let me know if that makes sense.
The command changes the PSR-4 configuration in composer.json.
Assume it was App before, your composer.json looks like this:
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
After running the command with php artisan app:name Foo, it will look like:
"autoload": {
"psr-4": {
"Foo\\": "app/"
}
},
Therefore the whole namespace has changed and your classes can't be found by the Autoloader. To fix this, you have to either go back to the old name or do a global search and replace to change the namespace from App to Foo.

Alias and provider name unknown for github library

I am trying to install this github library:
https://github.com/robholmes/term-extractor
I used composer by adding this in composer.json under "require":
"robholmes/term-extractor": "dev-master"
However, I'm not sure what I would put in the app.php config file under providers and aliases. What would be the lines I would add there?
This is not a Laravel specific package. No need to add service providers, as they don't exist.
composer require robholmes/term-extractor dev-master
Instead, just include it in your controller for use, etc:
use TermExtractor\TermExtractor;
To test it works (it should), in your controller method just return this:
$term_extractor = new TermExtractor();
return dd($term_extractor);

Laravel 5 Unable to detect application namespace

I'm new to Laravel 5 and trying to understand it bit by bit and at the moment I'm really confused with error messages. MVC is new thing to me.
What I'm trying to do is blog system for my site and I've downloaded package called "Serverfireteam/blog"; https://phppackages.org/p/serverfireteam/blog
It installed just fine, I guess. When I go to http://myhost.com/public/panel/login I get the login screen but when I login it gives me this error:
ErrorException in Application.php line 1119: Unable to detect application namespace. (View: /var/www/html/mpa2/resources/views/vendor/panelViews/dashboard.blade.php)
&&
RuntimeException in Application.php line 1119: Unable to detect application namespace.
Funny thing is it worked before just fine, I could login and make/edit blog posts and I could see them go to mysql-database. Also I was able to see them on site. Then I started to modify view/template files for integrating blog output to my site's own layout.
I've got no idea what gives, I've tried to google for solution but no help. Any ideas what could be wrong?
Okay, I solved it. What I did to solve this:
composer update
gave me following error:
[Seld\JsonLint\ParsingException]
"./composer.json" does not contain valid JSON
Parse error on line 9:
"require-dev
---------------------^
Expected: 'STRING' - It appears you have an extra trailing comma
I opened composer.json and there was one extra comma in last line:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
}
Removed the comma so it looked like this:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*"
}
And problem was gone.
Usually, this means that your composer.json file contains invalid JSON. Usually an extra comma at the end of an array.
Try running this to tell you exactly where the issue is:
composer diagnose
laravel version: 5.8.3
[One more Reason]: default app path in composer.json is modified
the default setup looks like this
"psr-4": {
"App\\": "app/"
},
If its modified to say,
"psr-4": {
"Core\\": "app/Core/"
},
the make commands with artisan wont work, and a few other things
the reason is https://github.com/laravel/framework/blob/5.3/src/Illuminate/Foundation/Application.php#L296
app is static in the path, and here is the where the exception is thrown https://github.com/laravel/framework/blob/5.3/src/Illuminate/Foundation/Application.php#L1143
This default behavior can be modified in bootstrap/app.php
Here is my solution [reference: https://laracasts.com/discuss/channels/general-discussion/how-i-can-change-laravel-directory-structure?page=1]
Solution:
Core/Application.php
<?php
namespace Core;
use Illuminate\Foundation\Application as IlluminateApplication;
class Application extends IlluminateApplication
{
protected $appPath = __DIR__;
}
bootstap/app.php
$app = new \Core\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
Please Write this Command on the project root
composer diagnose
This Command Will detect the problem
my case I found this
[Seld\JsonLint\ParsingException]
"./composer.json" does not contain valid JSON
Parse error on line 1:
3:06 PM 08-Dec-20{
^
Expected one of: 'EOF', '}', ',', ']'
Then I removed
3:06 PM 08-Dec-20
Then I have Created Controller Succesfully.
I Hope The composer diagnose Command Will Detect Your Problem.
What caused this for me was having lines commented with //. The // can be on its own line or at the end of the line. Also having comma at the end can cause this.
Removing the comments solved this. And/or removing the extra ending comma.
The error happens for "composer update", and artisan commands such as "php artisan make:controller TestsController --resource", or "php artisan make:model Test"
you could open composer.json with visual code.
and
it will parse and mark the issue
i have solve this issue like that

Setting up alias for master branch in composer

I am trying to package a module for use with composer. I have a valid composer file and I am able to install it with composer, but only when I specify that it should use dev releases (via the "#dev" version directive or minimum stability dev). I am having trouble packaging my repo so that it is seen as a master release.
I found a composer document about aliases that seems to be made for my case, but I cant get it working. Heres the relevant portion of my composer.json:
"extra": {
"branch-alias": {
"dev-master": "1.0"
}
}
Also for reference heres the require from my main projects composer file:
"require": {
"misterglass/kohana-twig" : "1.*"
},
And the actual error from composer is:
Problem 1
- The requested package misterglass/kohana-twig 1.* could not be found.
According to some helpful people on the #composer IRC channel, aliases are just to associate different versions to each other, and not to assign stability.
In order to for composer to consider it stable, you need to add a tag, which you can do on the command line or by creating a release in github.

Resources