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
Related
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.
I have tried to install the Symfony 4 on my Macbook Air by using Composer. I have used the below commands for installing and running Symfony application
composer create-project symfony/website-skeleton symfony4
cd symfony4
composer require server --dev
php bin/console server:run
And then tried to access the application in http://127.0.0.1:8000/. Below is the error message
Below image shows the error in which line and file
I am using PHP 7.2.3 and installed by using Homebrew. At the same time when I use the below command to install, Symfony welcome page appears without any error.
composer create-project symfony/skeleton symfony4
There is no default welcome page when you create new symfony flex application and there is an issue and a pull request already.
Everything is working fine you just don't have any pages.
Here you can read how to create a symfony page: https://symfony.com/doc/current/page_creation.html
I am new in symfony 3.0. I want to integrate ACL in my project.I am using following environment.
Symfony 3.0
OS: Windows
I did follow below link:
http://symfony.com/doc/current/cookbook/security/acl.html
When I run this command: php bin/console init:acl
I am getting following message:
[LogicException]
You must install symfony/security-acl in order to use the ACL functionality
Can anyone suggest how I can integrate it? Is there any demo URL and from where I can download the code?
You are missing a package that Symfony needs in order to activate ACL on your project.
To install such packages, you'll need to have a working Composer installation (Composer is a PHP dependency management scripts you can use to manage packages): see https://getcomposer.org/download/
Once Composer is running, you can open a console and go to the root of your project. There you can run the following command line option:
composer require symfony/security-acl
followed by:
composer update
Now you should be able to run the php bin/console init:acl command successfully.
I have installed Classification bundle and also install its depends bundle, I have configured all steps from http://sonata-project.org/bundles/classification/master/doc/index.html
But I have faced following error
PHP Fatal error: Class 'Application\Sonata\ClassificationBundle\SonataClassificationBundle' not found in myproject\app\AppKernel.php in line PHP Stack trace:
I have also registered this bundle in AppKernal and Application bundle found in src source directory, can anyone has idea about it?
Thanks
I think you forgot to run the following command:
php app/console sonata:easy-extends:generate --dest=src SonataClassificationBundle
This will generate a bundle in your Application folder as it is mentioned in the documentation here: http://sonata-project.org/bundles/classification/master/doc/reference/installation.html
I try to install SonataPageBundle on Symfony2, but I get an error during the bundle configuration...
I followed the Official Documentation for install the bundle and at the 3.3 step when I run the following command:
php app/console sonata:page:create-snapshots -site=all
I get this error:
Fatal error: Class 'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher' not found in /var/www/Symfony/app/cache/dev/appDevDebugProjectContainer.php on line 2631
Have you any idea about my problem?
You need to replace all the
Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher
In the project to
Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher
I just did this and it worked!
You may use Symfony 2.0, and missing
Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher
You can download package symfony 2.1 or master in https://github.com/symfony/symfony
Copy file ContainerAwareEventDispatcher.php in Symfony\Component\EventDispatcher folder in to your Symfony 2.0 (vendor\symfony\src\Symfony\Component\EventDispatcher)
I did it, worked fine!