Laravel: There are no commands defined in the "ab" namespace - laravel

I have to publish a database in my laravel 4 app from another package. So I ran this command:
php artisan ab:install
It says
[InvalidArgumentException] There are no
commands defined in the "ab" namespace.
I tried running composer dump-autoload and also tried php artisan optimize.
Composer still throws the InvalidArgumentException.
EDIT
I had missed adding the service provider and registering the alias in the app.php file. Doing so fixed this issue.

I had missed adding the service provider and registering the alias in the app.php file. Doing so fixed this issue.
I had to add 'Jenssegers\AB\TesterServiceProvider', and 'AB => 'Jenssegers\AB\Facades\AB',
to the app/config/app.php
This fixed the issue.

Try to update composer with json file. Add the following code in json
"jenssegers/ab": "1.*"
Then save . Open command prompt. run composer update

Related

Laravel: Composer update when dependency is not yet installed

I require a dependency on my local environment. I add it's service provider and all is fine. The composer.json has this script
"pre-update-cmd": [
"php artisan clear-compiled"
],
When I push the changes to production, I try to run composer update but because of that script artisan fails with an error since the dependency is not yet installed and therefore the service provider I added in config/app.php is not there yet.
What is the best approach to situations like this? Just remove the pre-update script?
Hmmm interesting problem
What are you typing in for the service provider in your app.php
Have you tried removing your service provider and then running composer update and re-adding it after the dependencies have installed?
Interesting problem,
Please check your json file with
composer validate from your working directory.

Class 'Dotenv\Loader' not found laravel 5.2?

I have both .env and .env.example file in root but still throwing error,Please help me
This exception has nothing to do with .env file. Is simply says that your program can not find Dotenv\Loader class.
Try to run composer update then composer dump commands.

Lumen php artisan config:cache not found

I'm trying out the PHP micro Framework Lumen (from laravel).
When I set up Lumen and I try to use the php artisan config:cache command like in Laravel, I get this error :
[InvalidArgumentException]
There are no commands defined in the "config" namespace.
So I have problem when I try to deploy the files to server, so I have to change .env file to change the database username and password.
This makes me think config is not available in artisan
How can I add it to artisan ?
Yes, you can not use the php artisan config:cache with your Lumen project, because it is not available out of the box.
You can add it by adding this package (orumad/lumen-config-cache) to your project:
composer require orumad/lumen-config-cache
In lumen you have to add this configuration in bootstrap/app.php file
$app->configure('custom_config_file_name');
#example
$app->configure('custom_emails');
Then you can access like below:
config('filename.key_name');
#example
config('constants.email');
Lumen no need to config:cache.
You do not need to do anything after change ‍‍.env

moving Laravel project between computers

I have been working on a laravel5 project on a computer , but now I want to continue on an other, but don't know how :(
I'm using wampserver and the project is in the "www" folder, this is the error I'm getting when trying to open the project: " Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"
Your error message is very vague, so it is hard to pinpoint the cause. I assume you just copy pasted all of the project files
Try these steps:
Make sure you copy all of the project files including the hidden ones(.env).
Prepare your destination computer as in http://laravel.com/docs/
Check you have all the necessary PHP extensions available in php.ini as in above link requirements. Also, watch your PHP version!
Install composer https://getcomposer.org/doc/00-intro.md
When copied, go to your destination folder and run composer install.
Run php artisan key:generate from the command line.
Run php artisan cache:clear from command line
http://php.net/manual/en/install.windows.commandline.php
Make sure your webserver is serving pages from project/public folder.
If laravel is failing, check the log file to see the cause
your_project/storage/logs/laravel.log
Copy the project folder and navigate terminal/cmd
just run following commands.
Create database and place the same name at .env file in laravel project folder
1. composer install
2. php artisan key:generate
3. php artisan cache:clear
4. php artisan migrate
UPDATE: If you're getting
Whoops, looks like something went wrong
in app/config/app.php, set debugging as true with:
'debug' => env('APP_DEBUG', true)'
If you're getting the error
No supported encrypter found. The cipher and/or key length are invalid
for some people it worked to do cp .env.example .env before (2).
You would also have to create new storage link, because Laravel uses absolute path inside it.
php artisan storage:link
https://stackoverflow.com/a/32722141/3982831 Please follow this to resolve your problems. All people forget about permissions on folders.
After you have done as Ademord answer, you might need to use refresh to your WAMP, XAMP or any other development stack you are using. I had the same issue plus changes were not reflecting in the front end. For example new routes in the web.php were not updating.

Error while creating migrations table with laravel: "No such file or directory"

When trying to run php artisan migrate:make create_users_table I get the following output in Windows CMD:
{"error":{"type":"ErrorException","message":"require(C:\...\\localhost
\\sites\\makeitsnappy\\app\/filters.php): failed to open stream: No such file or
directory","file":"C:\\...\localhost\\sites\\makeitsnappy\\app\\start
\\global.php","line":83}}
I'm running Windows 8. Laravel 4 and installed Composer, also ran composer update in the project folder. Same error happens.
Edit: Loading the application webpage, I get:
require(C:\.../localhost\sites\makeitsnappy\app/filters.php): failed to open stream: No such file or directory
Also, there is no filter.php file.
How can I fix this problem?
Since Laravel4 the routes and filters are in two different files: routes.php and filters.php not like in Laravel3 where both lay in the same file.
Check if there is a filter.php file in you app/ folder.
The error occurs because the autoloader tries to load this file on application's startup to get the filters for the called route or global filters.
Running composer update won't help here because you only get the framework and it's dependencies via composer and it doesn't update your app/ folder.
did you do composer install? It downloads some important files. I think you missed this command!
composer install

Resources