Laravel ide-helper installed fine but doesn't generate - laravel

BarryVdh's ide-helper has been sucessfully installed to my Laravel project as the composer.json desribes:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
...
},
"require-dev": {
...
"barryvdh/laravel-ide-helper": "^2.1",
"doctrine/dbal": "^2.9"
},
Added to providers in app/config as:
'providers' => [
...
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
],
I assume it partially works as the command php artisan ide-helper:meta generates .phpstorm.meta.php in the root folder, but the php artisan ide-helper:generate command fails with the following simple error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected end of file
If I try to generate model info with the command php artisan ide-helper:models, asks for overwrite models or to write to _ide_helper_models.php instead, 'no' chosen, it fails and throws the same error above. However, if I add a model to the command (eg. php artisan ide-helper:models Order ), after choosing 'no' for overwrite the ide-helper generates the _ide_helper_models.php file without any relevant content, just the default comment block.
What to check in this case?
(phpStorm IDE, win10, Laravel 5.1, Xampp, PHP7)

Related

Laravel Autoclosing after clicking one request

I have a problem when declaring autoload in laravel,
i have been using laravel 8 and php 7.4.3 this is the problem
After i get another request, the laravel runner always closing and give me this error
To solve this error, i've always do the
php artisan key:generate
or do another thing like restarting the laravel after dump autoload
composer dump-autoload
php artisan serve
But the problem just solve for one time, and it will be error again until i dump the composer again
How can i solve this?
In your composer.json file you should have the following line
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
And in you artisan file you should have the following
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
The composer.json code should autoload any content coming from the App directory, while the require /vendor/autoloader will load vendor content into your project. Also you must have app.php inside of the bootstrap directory to allow the app to use the Kernal corrently. Hope this helps!

my error : Class 'Maatwebsite\Excel\Excel' not found

this errormy composer.json:
...
"maatwebsite/excel": "^3.1",
...
I can run my project on localhost but when I upload on server I got this error message:
Class 'Maatwebsite\Excel\Excel' not found
my laravel version:
Laravel Framework 8.80.0
Please make sure that you imported class in config/app.php
If not then please add below line in prividers array in config/app.php file.
Maatwebsite\Excel\ExcelServiceProvider::class
then publish vendor by
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider" --tag=config
Then after
composer dump-autoload

Lumen first install - ReflectionException: Class redis does not exist

I am playing around with Lumen, I installed it via Lumen installer. After I do composer install, I try to use artisan but it throws the following error:
ReflectionException: Class redis does not exist in Container.php on line 752
My composer.json:
"require": {
"php": ">=7",
"ext-pdo_pgsql": "*",
"ext-soap": "*",
"guzzlehttp/guzzle": "^6.3",
"laravel/lumen-framework": "5.5.*",
"laravel/tinker": "^1.0",
"vlucas/phpdotenv": "~2.2"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.4",
"doctrine/dbal": "^2.5"
},
Thanks in advance.
I had the same.
Solution:
composer require illuminate/redis
Register it in bootstrap/app.php by calling
$app->register(Illuminate\Redis\RedisServiceProvider::class);
in the file, under Register Service Providers.
From this aricle.
From Lumen's official documentation at https://lumen.laravel.com/docs/7.x/cache :
Redis Support:
Before using a Redis cache with Lumen, you will need to install the illuminate/redis package via Composer. Then, you should register the Illuminate\Redis\RedisServiceProvider in your bootstrap/app.php file:
$app->register(Illuminate\Redis\RedisServiceProvider::class);
If you have not called $app->withEloquent() in your bootstrap/app.php file, then you should call $app->configure('database'); in the bootstrap/app.php file to ensure the Redis database configuration is properly loaded.

Lumen 5.4 with Laravel Mailable

Naive question: is there a way to use Artisan to create a Mailable class within Lumen framework like this: php artisan make:mail OrderShipped (example taken from the docs).
Here is the composer.json
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/lumen-framework": "5.4.*",
"vlucas/phpdotenv": "~2.2",
"firebase/php-jwt": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"illuminate/mail": "5.4",
"phanan/cascading-config": "~2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~5.0",
"mockery/mockery": "~0.9"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/",
"database/"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
This is how bootstrap/app.php has been modified (added all of these):
$app->withFacades( true, [
'Illuminate\Support\Facades\Mail' => 'Mail',
]);
$app->register(\Illuminate\Mail\MailServiceProvider::class);
$app->configure('mail');
$app->alias('mailer','Illuminate\Mail\Mailer');
config('mail');
And this is what php artisan gives me:
Laravel Framework Lumen (5.4.7) (Laravel Components 5.4.*)
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
migrate Run the database migrations
auth
auth:clear-resets Flush expired password reset tokens
cache
cache:clear Flush the application cache
cache:forget Remove an item from the cache
cache:table Create a migration for the cache database table
db
db:seed Seed the database with records
make
make:migration Create a new migration file
make:seeder Create a new seeder class
migrate
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:rollback Rollback the last database migration
migrate:status Show the status of each migration
queue
queue:failed List all of the failed queue jobs
queue:failed-table Create a migration for the failed queue jobs database table
queue:flush Flush all of the failed queue jobs
queue:forget Delete a failed queue job
queue:listen Listen to a given queue
queue:restart Restart queue worker daemons after their current job
queue:retry Retry a failed queue job
queue:table Create a migration for the queue jobs database table
queue:work Start processing jobs on the queue as a daemon
schedule
schedule:run Run the scheduled commands
I am on OS X El Capitan, Apache2, PHP 5.6.31
So again, how (if at all) can I use artisan to make:mail? If this is not achievable without full-blown Laravel, is there a template to create Mailable classes? Will they be usable?
Refs:
https://laravel.com/docs/5.4/mail#generating-mailables
https://scotch.io/tutorials/easy-and-fast-emails-with-laravel-5-3-mailables
Lumen 5.3 send email (no make:mail?)
Yes, there are some packages that allow that exactly. For example:
https://github.com/flipboxstudio/lumen-generator
As stated on their readme, to install the Composer package:
composer require flipbox/lumen-generator
And then add on bootstrap/app.php file:
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
If you then run php artisan on command line, you get new commands:
Available commands:
clear-compiled Remove the compiled class file
help Displays help for a command
list Lists commands
migrate Run the database migrations
optimize Optimize the framework for better performance
serve Serve the application on the PHP development server
tinker Interact with your application
key
key:generate Set the application key
make
make:command Create a new Artisan command
make:controller Create a new controller class
make:event Create a new event class
make:job Create a new job class
make:listener Create a new event listener class
make:mail Create a new email class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:policy Create a new policy class
make:provider Create a new service provider class
make:seeder Create a new seeder class
make:test Create a new test class

Illuminate\Session\SessionInterface not found

I am trying to run Laravel 4 application in Google App engine. I am following this tutorial but the problem is that when I run it by using cmd
C:\Program Files (x86)\Google\google_appengine>python dev_appserver.py --skip_sdk_update_check=yes --port=8080
--admin_port=8000 --php_executable_path=C:\wamp\bin\php\php5.4.12\php-cgi.exe C:\laravel-test\laravel
it shows the following error:
Fatal error: Interface 'Illuminate\Session\SessionInterface' not found in C:\laravel-test\laravel\bootstrap\compiled.php on line 7301
compiled.php: http://laravel.io/bin/ekP5m
I Also got this error during update using composer.In the composer.json file. there should not include two require parts
ex : --- this is not working
"require": {
"laravel/framework": "4.0.",
"neoxia/laravel-openssl-encryption": "1.0."
},
"require": {
"evernote/evernote": "dev-master"
},
this will work
"require": {
"laravel/framework": "4.0.",
"neoxia/laravel-openssl-encryption": "1.0.",
"evernote/evernote": "dev-master"
},
please check your file and make sure about that i think this will work

Resources