Creating Symfony Application doesn't work - php

When I create a new symfony application with the command "symfony new --webapp app", in the repository src, I don't have the controller repository nor the kernel.php.
During the installation and after, I don't have error messages.
I always created my projects like that without problems. It's why I don't understand what happens.
PHP version : 8.1.8
Symfony version : 6.2
I also tried the command
composer create-project symfony/skeleton:"6.2.*" my_project_directory
but the problem is the same. I've also checked
symfony check:requirements
And according to this everything isfine.
And naturally, when I wanted to create a controller, the console tells me the class kernel was not found.

Related

Symfony framework problem with creating controller

I just started to learn Symfony framework and I got stuck on very begging.
I created with composer with following commands:
composer require symfony/maker-bundle --dev
composer require annotations
php bin/console make:controller ToDoListController.php
Code looks good, but when I try to open this controller I am getting an error message:
Uncaught Error: Class 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController' not found in C:\xampp\htdocs\symfony44\src\Controller\ToDoListController.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\symfony44\src\Controller\ToDoListController.php on line 9.
I am using xampp as a local server, symfony 4.4
Has anyone encountered with this problem?
Please install symfony using the symfony app. Download the app for windows from https://symfony.com/download.
Open the windows command prompt.
type the following commands
symfony new project-name --full
cd project-name
symfony serve
symfony serve starts your development server. Use apache when your app is deployed. With the symfony app you can use https. This method of symfony installation is easy and it is good for those new to symfony. With the --full option maker bundle and all other important bundles are installed for you. You can just start creating controllers

Heroku Class 'NumberFormatter' not found

Deploying my Laravel 7 app in Heroku I get this error, it appears only in Heroku, not on my local box (localhost)
Class 'NumberFormatter' not found (View: ...)
Server Details:
Heroku
PHP 7.4.12
Laravel Framework 7.30.4
The NumberFormatter classDocs requires the PHP Internationalization extension (intl)Docs, and this extension is not available built-in on Heroku Heroku Built-in ExtensionsHeroku Docs.
Instead Heroku gives you permission to use optional extensionsHeroku Docs.
To make use of them you can either use the composer command to require it ("ext-intl"):
composer require ext-intl
Or you can manually add this to composer.json in the require sectionComposer Docs:
{
"require": {
"ext-intl": "*"
}
}
Commit the file and push the changes to Heroku. The error should be gone until you find the next missing class.
This is another example, why it is a good idea if you have a Composer based PHP project, to document the extensions in use as well in the composer.json file.
When the day comes, you have them documented in the Composer JSON already.
And systems like Heroku can benefit from it, too!

problem with laravel 8 : Class 'Illuminate\Support\Facades\RateLimiter' not found [duplicate]

I've created my laravel project as follows:
laravel new my_app
This creates my project using laravel version 8. As I want to use Laravel 7, I modified composer.json:
"laravel/framework": "^7.0",
After that I run:
composer update
which ends with the error described (Class Illuminate\Support\Facades\RateLimiter not found )
In fact, that class doesn't exist in Support facade. Shouldn't downgrade process correct this?
No, this is from code in your application; specifically your App\Providers\RouteServiceProvider. Everything that isn't in vendor is considered your application and is not touched by any upgrade or downgrade. The laravel/laravel package only sets up your application skeleton for you. You can install Laravel 7 specifically with composer create-project --prefer-dist laravel/laravel:^7.0 yourproject; you can find the instructions in the install guide for Laravel 7.
Otherwise you will need to potentially copy the Service Providers from laravel/laravel version 7 into your application so you are not using providers from Laravel 8 as some things have changed and some new features were introduced. And there would be other changes as well.
Laravel 7.x Docs - Installation - via Composer Create-Project composer create-project

Symfony - can't run created console command

I've created a file called GenerateRandomUserCommand.php inside vendor/symfony/console/Command. Its namespace is set to: Symfony\Component\Console\Command it extends Command aswell. Clean composer and Symfony installation. The problem is, I can't make command working. I write: php bin/console mycommand (it is set of course in class) and I have a message: Command "mycommand" is not defined.
What's the problem? I did nothing in kernel or config, everything is default.
It's need to see that not working command file. But I can suggest to you use symfony maker bundle.
First, require bundle for dev env: composer require maker --dev
Then simply type in console bin/console make:command. After typing name it was generate command skeleton with some simple example. And I beleive that's all you need =)
The problem was, I must register command. Despite of autoregistering provided by Symfony...

Installing Laravel 4.1 with Laravel Installer

I'm trying to install Laravel 4.1 using the Laravel installer but the docs isn't very descriptive.
Can someone please give a step by step guide on how to do this? I'm completely new to Laravel and PHP frameworks as a whole.
I'm on a Windows 7 machine running WAMP 2.2.
This information/answer isn't quite up to date anymore. The instructions here will install the latest version which is no longer 4.1. For those still wanting to install Laravel 4.1 (despite 4.2+ being out), use the following command.
composer create-project laravel/laravel project_name 4.1
You could replace the 4.1 with 4.0 or 4.2 depending on your situation.
Laravel 4.1 is handy if you aren't in control of your PHP version and you're stuck back on 5.3.7
Laravel 4.2 requires PHP 5.4.
When upgrading a project to a newer version of Laravel, be sure to review the release notes
Installing Laravel means simply downloading Laravel Application bootstrap, which has to be placed in your project directory. That application has a composer.json file, which will, after you run composer install command, download all necessary dependencies (including core framework).
That is one way. Another preferred way is directly through:
composer create-project laravel/laravel project_name
In both cases, you need to have composer installed on your machine. Composer is a modern PHP package manager, which has a ton of benefits (autoloading, custom commands...).
There is really no need for two downvotes, especially when this guy was reading documentation, which he couldn't understand. We were all installing Laravel for the first time.
If you want install laravel via Laravel Installer use this method:
First, open up command line. then enter:
composer global require "laravel/installer=~1.1"
Now go to:
C:\Users\ {User Name} \AppData\Roaming\Composer\vendor
Copy and paste vendor in your destination folder.
Now in your destination folder hold the shift key down and press right click and in opened navigation menu click on "open command window here" then enter command below:
laravel new your_project_destination
Ex:
laravel new laraveltest

Categories