Laravel Traits Error - php

Fresh install of Laravel, trying to run anything generates a Traits error:
Trait 'Illuminate\Support\Traits\MacroableTrait' not found in /var/www/laravel/bootstrap/compiled.php
I have tried manually adding in \Traits\MacroableTrait.php and this now generates a new error:
Trait 'Illuminate\Http\ResponseTrait' not found in /home/vagrant/innovedV2API/bootstrap/compiled.php
Any ideas what's happening here?

Try to edit your composer.json in a way to put all "require" elements together, like this:
"require": {
"laravel/framework": "4.2.*",
"dompdf/dompdf" : "dev-master",
"stripe/stripe-php" : "dev-master",
"fzaninotto/faker" : "dev-master"
}
I think my error was that I have written another require block with faker, dom and stripe at the end of the file, and tried to run composer update like that.
Another error may be migrating databases before composer update, or artisan db:seed

Related

Geolocation package with laravel: Midnite81\Geolocation\GeoLocationServiceProvider' not found

I want to use the following package for geolocation with laravel.
https://github.com/midnite81/geolocation
I have done everything they wrote in their documentation but find an error
Midnite81\Geolocation\GeoLocationServiceProvider' not found
i am unable to solve this problem. Can't understand what's wrong. What i did, at first, write "midnite81/geolocation": "1.*" in the composer.json file.
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"midnite81/geolocation": "1.*"
},
After that run composer update. Then run composer dump-autoload -o. Then in the config/app.php file, put the following part in providers and aliases array.
'providers' => [
Midnite81\Geolocation\GeoLocationServiceProvider::class
];
'aliases' => [
'GeoLocation' => Midnite81\GeoLocation\Facades\GeoLocation::class,
];
then run the following command.
php artisan vendor:publish --provider="Midnite81\GeoLocation\GeoLocationServiceProvider"
Then got the error, Midnite81\Geolocation\GeoLocationServiceProvider' not found
Can't figure out what's wrong in it.
I verified and confirm the problem.
The problem is:
Midnite81\Geolocation\GeoLocationServiceProvider::class
You should change this into
Midnite81\GeoLocation\GeoLocationServiceProvider::class
Notice the difference Geolocation vs GeoLocation. It seems there is error in readme for this package on Github
I've already sent Pull request https://github.com/midnite81/geolocation/pull/2 to fix readme for this package

Codeception actor not found exception

When running codecept run -vvv I get an error stating that the actor is undefined in the SuiteManager class (method is initialize).
Any guess on how to fix this?
I've set up two basic unit tests where I just want to assert some values, and they worked until I switched to the composer autoloader.
In the composer.json I have the following:
"autoload": {
"classmap": [
"app"
]
},
"require-dev": {
"codeception/codeception": "^2.3",
"phpstan/phpstan": "^0.8.0",
"symfony/console": "^3.3"
}
In the main _bootstrap file provided by Codeception I only have a require_once for the vendor autoloader file.
Using php 7.1 and latest versions of the packages.

Laravel 5.1 Php artisan commands not working after composer update

here is my composer.json require snippet.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.35",
"aws/aws-sdk-php-laravel": "~3.0",
"lucadegasperi/oauth2-server-laravel": "5.1.*",
"bosnadev/repositories": " 0.*",
"laravelcollective/html": "5.1.*",
"cartalyst/stripe-laravel": "3.0.*"
},
I ran composer update in order to add new AWS services. but then I noted that all the vendor files are updated because of composer update command. now I'm getting error when I ran php artisan commands.
This is the error message:-
PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator
::__construct() must be an instance of Illuminate\Http\Request, null given, call
ed in C:\Users\User\projects\projectxyz\projectxyzweb\vendor\laravel\framework\
src\Illuminate\Routing\RoutingServiceProvider.php on line 62 and defined in C:\U
sers\User\projects\projectxyz\projectxyzweb\vendor\laravel\framework\src\Illumi
nate\Routing\UrlGenerator.php on line 102
How can I resolve this issue? is there any wayto revert composer update without loosing my code?
I finally manage to get rid of this error. I was not my composer update. I have added url() to set base url in my config files. After removing it php artisan worked.

How do i upload to amazon s3 using Heroku composer amazon aws sdk

I'm using heroku and i'm following this tutorial here, https://devcenter.heroku.com/articles/s3-upload-php
I have placed the composer require line in my composer.json file as shown below.
{
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
},
"require" : {
"aws/aws-sdk-php": "~2.6"
}
}
As you can see i placed the amazon one last. However, i'm receiving the following error message.
2015-02-27T16:26:05.499004+00:00 app[web.1]: [27-Feb-2015 16:26:05 UTC] PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /app/web/fb/fileupload.php on line 4
Does anyone know if i have to do anything other than place that line in my composer json file???? please help
You now have two "require" keys, how is that supposed to work? It's a hash map, the keys overwrite each other!
This is what you want:
{
"require": {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"aws/aws-sdk-php": "~2.6"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
And then you of course have to run composer update to generate a composer.lock, and check that into the repos along with the rest of your code.
Why don't you run the app locally on your computer before pushing it up to Heroku?
So looks like an include can not find vendor/autoload.php
Are you sure that it exists?
vendor folder should be in fb folder an have that file.
Remember it is case sensitive.
Just make sure that you point to proper file on an include.
Make sure you ran composer install

Laravel 4 - Extend application controller from a package

Background
I know what I'm trying to do sounds a bit wrong but I do have my reasons.
Basically I have a central core app that's a default laravel app with a few tweaks and boilerplate code, I have then developed a series of packages that can be used to extend the app through composer. These packages are not meant to function without the core framework so a dependency upon it is fully expected.
What I want to do
What I would like to do is have a BaseController in my core app and have the various controllers in my package extend this BaseController to provide universal functionality throughout the various module packages.
I was expecting to be able to place the base controller in app/controllers/BaseController.php
and then extend it from my package using:
class PackageController extends \BaseController{}
Unfortunately when I do this it still looks within the package (currently workbenched) for the controller and I get the error:
include(/var/www/l4core.dev/workbench/myvendor/mypackage/src/controllers/BaseController.php):
failed to open stream: No such file or directory
Can anyone tell me what I'm doing wrong here. I am looking for a solution which allows me to easily move my packages between vendor dir and workbench for development. Any help greatly appreciated
Update
The previously mentioned error message appears to have been due to an include in my packages /vendor/composer/classloader.php - I have now deleted the vendor directory and done a fresh composer install. This has not solved the problem but it has at least shifted it as I now get the following error message:
Class 'BaseController' not found
My Packages composer.json
{
"name": "modules/sesame",
"description": "",
"authors": [
{
"name": "any",
"email": ""
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.0.x",
"zizaco/confide": "dev-master",
"zizaco/entrust": "dev-master",
"conarwelsh/mustache-l4": "dev-master"
},
"autoload": {
"classmap": [
"src/controllers",
"src/models",
"src/migrations",
"src/seeds"
],
"psr-0": {
"Modules\\Sesame": "src/"
}
},
"minimum-stability": "dev"
}
Be sure to execute:
php artisan dump-autoload
And verify that your class BaseController is in /vendor/composer/autoload_classmap.php.
OR like the OP stated, removing the vendor directory and running composer install again could sometimes solve the problem.

Categories