How can I specify the symfony version of my project in netbeans? - php

I am trying to create a symfony2 project, with the symfony2.8 version. However whenever I create a symfony project in netbeans I cannot find where to specify the version of symfony and it always creates a symfony3 project. Is there any way to tell netbeans to use the symfony2 version instead of 3?

I'd save yourself the headache and time of trying to figure that out, and instead use the Symfony recommended way.
php -r "readfile('https://symfony.com/installer');" > symfony
# for example, if WAMP is used ...
">c:\> move symfony c:\wamp\bin\php
# ... then, execute the command as:
">c:\> symfony
# moving it to your projects folder ...
">c:\> move symfony c:\projects
# ... then, execute the command as
">c:\> cd projects
">c:\projects\> php symfony
https://symfony.com/doc/current/setup.html
Net-beans will still recognise your project as a Symfony project along with all the added benefits, but also with the ease of setting up new Symfony projects with one command from the CLI.
If you really want to stick to the Net-beans way, simply allow Net-beans to install it, however it chooses. Once it's installed change the version number within the composer.json file. The biggest issue you'll have for this is you'll have to check all your version numbers are compatible.

Related

How to include a Project from a server into a Laravel sail docker image

I am totally new to PHP / Laravel / Linux / composer / docker etc.
However I do have the task: go retrieve some code files from an internal server and make a docker container out of it. The project is written in PHP 7.1.3 and uses the Laravel framework.
I've copied the whole https folder from the server which I think contains everything I need.
I also was able to create the example app from the Laravel documentation and also I made a brand new Laravel project. However, is there any chance to "generate" a new project using all the code files I have right now?
I even have a composer.json and composer.lock file, which in my opinion should "list" every component I would need in my docker installation, right?
What also bugs me is that I can't even get the project working on my dev machine...
I think you should do this step by step. But let me first answer some of your questions.
If "https" folder contains similar folder structure like fresh Laravel installation, it is likely to be all of it. But we can not be sure about it.
As far as i know there is no way to generate new project out of your files. First of all you need to know which Laravel version project uses. It must be stated at composer.json.
In you composer.json file lists required packages for you project. When you install them this packages are installed folder called vendor
Here is my suggestions;
As you stated it seems you are very new about these topics if someone give these task to you its not a smart way to teach this kind of topics.
I think you have to start with running project in your local machine. If you get errors than ask them in a new question. Most likely you need database and you need to know running migrations seeds etc.
When you manage to run the project you can start dockerizing your project. If your project is build with newer versions of laravel you can easly use sail otherwise you can build own dockerfile or upgrade laravel to newer versions.
Your problem is too broad, i think you cannot find answers to such question.

Symfony CLI does not use the correct PHP version when running the "new" command

I have setup my environment as follows: Wamp 3 with PHP7.1.33 version, composer 2 and the Symfony binary.
But when I try to run symfony new my_project_name --version=4.4 --full I get this error:
Creating a "symfony/website-skeleton" project at "./my_project_name"
Your version of PHP, 5.4.12, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.
[InvalidArgumentException]
Could not find package symfony/website-skeleton with version 4.4.* in a version installable using your PHP version,
PHP extensions and Composer version.
As mentionned in the error, PHP 5.4.12 is used, but when I run php --version I get 7.1.33 version.
I haven't used either WAMP or the Symfony binary, but on the documentation it says:
If you have multiple PHP versions installed on your computer, you can tell Symfony which one to use creating a file called .php-version at the project root directory
If you have multiple PHP versions installed, apparently the tool attempts to find them and list them if you use the symfony local:php:list command. No idea how it works or how reliable it is, but should tell you if it's able to detect your PHP 7 runtime.
More importantly, despite the poor advice on Symfony part, you do not really need to use the symfony binary to create a project. The binary simply calls composer, so why not call composer directly? That way you can be sure you are using the PHP and Composer's versions you want and expect, instead of relying on an intermediary.
Just do:
composer create-project symfony/website-skeleton your-project-name ^4.4
(this is what you get by using the --full flag, if you do not use it you simply install symfony/skeleton, which includes less components out of the box).
As an aside, naming the binary symfony was a really poor choice on Symfony's part, as it makes it almost impossible to search for issues related to the tool and not the framework. Or to suggest to use the binary instead of using composer directly, adding a layer of opacity for many users.

Unable To Install Symfony Windows 7

I am trying to install Symfony, but unable to find how can we start with symfony with Xampp. I have already tried on google but there is no proper solution for installation and configuration of Symfony.
As I want to edit a project which is already developed using symfony CMS.
Symfony is not a CMS.
If you need to run a symfony app locally, all you have to do is to copy all files into a project subdirectory inside your Xampp (for example htdocs/symfony).
I assume existing project will have a database, so be sure to import your database locally or use external database. You need to tweak your symfony config file: http://symfony.com/doc/current/configuration.html
I am trying to install Symfony, but unable to find how can we start with >symfony with Xampp. I have already tried on google but there is no proper >solution for installation and configuration of Symfony.
As I want to edit a project which is already developed using symfony CMS.
Hi, for begin Symfony is not a CMS but a framework ^^, it's a little bit (alot) different.
For install Symfony WHY use google O_o ----> http://symfony.com/doc/current/setup.html
After, why Xampp ? for windows use Wamp who do the local server it's more performing :/
And if you want you don't have necessary to install symfony if it's an existing project -> just clone it (if he is on github) ... and just open the complete folder with your IDE or text editor.
You can modify the file without problems, (just you can have a prob for use command php bin/console.
Good luck i hope it's answering all you questions :)

Netbeans and Zend Framework 2 configuration - zh.sh file

I am new to PHP and Zend Framework 2.
I am currently going through the ZF2 tutorial. I've run the commands:
php composer.phar self-update
php composer.phar install
Then opened up the latest Netbeans version. However, when asked for the zh.sh file, I couldn't find it anywhere in the zf2-tutorial folder. Is this file something that we need to create or is it expected to exist by default in the ZF2?
It'd be great if someone could point me to the right direction.
As other have hinted, NetBeans has not caught up to ZF2 yet (ZF has only been out for a handful of weeks).
As of right now, ZF2 has no command-line tooling (ie: zf.sh). Instead, you're encouraged to use the Skeleton Application to get things started.
While NetBeans doesn't have any specific ZF2 support, it's still a great IDE to use while developing ZF2 projects.
Just skip the ZF-specific stuff. Grab the Skeleton App, and create a new NetBeans project ("from existing sources"), and start hacking.
In all honesty, I can't remember ever using any of the ZF-specific stuff in netbeans. The framework is just a bunch of PHP files, and NetBeans works well without any framework-specific knowledge.
I don't know the content of zf.sh, but I was using this zf.bat in windows as it should be zf.sh in linux so's. This way I got from netbeans my zend core in the creation project phase ( with no errors):
git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install
With Zend included in php.ini, and COMPOSER_PROCESS_TIMEOUT=5000 set in the same file (also set max_execution_time=5000). This is because it didn't work for me to put it in command line orders.

Run command in symfony2

I'm trying to create my first page in Symfony2 according to this tutorial: http://symfony.com/doc/2.0/book/page_creation.html. Can anyone please tell how should I run this command:
php app/console init:bundle "Acme\StudyBundle" src
I'm new to symfony and I have no idea what this means...
php app/console init:bundle "Acme\StudyBundle" src
is a shell command you're meant to run at the command line of the machine you've installed Symfony on. You change into the directory where you installed symfony, and run it -- how you do that is obviously operating system- and installation-dependent.
The command itself invokes the command-line version of your PHP interpreter (php) to run Symfony's console script (app/console) to initialise a new Symfony bundle (init:bundle) called StudyBundle, from the (pretend!) company Acme (Acme\StudyBundle) in the directory src.
For me, running it would look a bit like this (from Terminal, on a Mac):
Matt-Gibsons-iMac:~ matt$ cd Sites/Symfony
Matt-Gibsons-iMac:Symfony matt$ php app/console init:bundle "Acme\StudyBundle" src
Summary of actions
- The bundle "AcmeStudyBundle" was created at "src/Acme/StudyBundle" and is using the namespace "Acme\StudyBundle".
...
A word of warning, though: Symfony 2 is still very new -- not yet even officially released -- and while what documentation there is is okay, the docs are nothing like as complete or helpful to the beginner as the excellent, mature documentation for Symfony 1.4. Also, Symfony 2 best practices have yet to be established.
So, if you're a complete Symfony novice you might find Symfony 1.4 easier going, especially following the Jobeet tutorial. Even though Symfony 2 is quite a big change from Symfony 1, learning Symfony 1 will introduce you to a lot of concepts that remain familiar in Symfony 2, such as generating new code modules from the command line, like you're trying to do here.

Categories