How to use Symfony framework with Mercurial? - php

I'm starting to use the Symfony php framework.
Where can I find information about the use of Mercurial in my symfony projects?

There are two things you need to keep in mind:
First: Put an .hgignore file in the root folder of your project. Put the following content in this file:
.project
^cache$
^log$
web/uploads
nbproject
nbproject is only needed if you are working with netbeans.
Second: At the moment there is no mercurial repository for Symfony itself, so you can not use the framework as a subrepository at the moment (BTW: I'm planning to setup one on bitbucket in the next days). So if you are using Symfony with svn:external at the moment you need to put a complete copy in the lib/vendor/symfony folder
Thats it :-)

Related

Edit Laravel framework files on Heroku

I have a Laravel app on Heroku that I would like to edit a framework file on (Request.php to be specific). But when I push the changes, it seems to get overwritten by the server.
Is this possible?
Thanks!
Laravel framework files are inside vendor folder which are ignored by git. i.e in you .gitignroe file. So any changes you make won't be push to heroku until you removed them from .gitignore. Also, alternating the vendor folder is not a good practice. If you want to overwrite them then don't directly modify them. You can use marcos for this. Look here to know about marcos more, the docs are clear and on point
Response::macro('foo', function($value){
//You custom task
return Response::make($value);
});

Symfony 4 how to use my own Bundle

I have my own Admin Bundle which is being developed in time. I just put it into new project and use it. If I need a new functionality I add it and use it later in another project. I put it in src/ directory. I don't want to store in on public Git repository.
Now as Symfony 4 is bundle-less, how should I easly put it into src/ dir so that it is decoupled from other App code?
I would like to develop the App as I shoulg but I would like to have an opportunity to easly copy Admin code to use it for another project.
Bundles are still perfectly available and useful in Symfony 4. They aren't suggested to be used for the main program code, as it is a little easier to not need that structure.
3rd party bundles are still incredibly useful though, to easily connect functionality, templates and services to an application. Equally, if you have some code that can be used in multiple applications and most easily added as a bundle, you are perfectly able to write your code as its own bundle. You can initially write it within your src/ directory, and then migrate it out to be an external bundle/library that can be pulled in via Composer when it's useful to do so.

Git repo inside another repo

I have directory structure which looks like that
Framework folder is from https://github.com/yiisoft/yii
For now, I'm updating framework folder like that.
Created another folder for Yii framework. Pulling every update and then duplicating framework directory into framework folder.
I want to automate this routine work. Is there anyway to update this framework folder from https://github.com/yiisoft/yii with commands like
cd framework
git pull
It might be wrong of course, but I'm newbie to git.
Any suggestions?
Thanks in advance
I think you should use Git Submodules:
It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other.
...
Git addresses this issue using submodules.
Here's a wiki explaining how to manage it in Yii

configure zend framework library path

i want to know where can i put the "library" folder in my zend project. Presently i have it in the location of my Zend server. This is my current "library" path:
E:\zend\ZendServer\share\ZendFramework\library
And here is the path to my "app" project:
E:\zend\Apache2\htdocs\app
Inside the "app" project, i have the folders like "public" and "application".
Now how can i integrate the "library" into my "app" project, without referencing it from zendserver?
The easiest way it is to put those library files to the library dir (as in the other answers), but you should consider keeping them separated from the application.
It's easier to have separate git or svn repos for the libraries. Easy to update and maintain for multiple projects at once. Putting them in library will also won't work if you installed the libraries from the bundle, e.g. apt-get install zend-framework-library.
To have the libraries in any directory you want, just add it to the include_path array in the index.php.
Quite often, you'll see a folder called like "lib" or "libraries" in your application (next to public, application, ...).
In that folder, you'll put the frameworks you're using.
For example :
public
application
libs
Zend
Doctrine
...
To get Zend Framework, just download it, and unpack it to the right folder ;-)
Advantage : you'll be using the version of your choice -- and not the one, possibly outdated, provided by your environment.
And, as a reference, you might want to read the Installing The Zend Framework chapter of the e-book Survive the Deep end.
In your app project u should have a library folder and should contain zend folder in that..so just copy library folder and put it in E:\zend\apache2\htdocs\app.
Please don't tell people to deploy 3rd party libraries to their application project folder, it is bad practice. Deploy your libraries to a path that you have access to, which is outside of your project, and reference it in your include path.
During development, it is fine to have the library in your project, for reference sake, but exclude it in your deploy script and instead have your deploy script either set an environment variable, or have it update your include path.

Zend Framework: How to load existing project into ZF's CLI?

In ZF you create a project by running this command:
zf create project MyProjectName
But how does one load a project that already exists?
I don't see anything in the documentation that specifies a zf load project or zf set project or something like that.
Thanks.
This is not yet possible to my knowledge, but on the to-do list
See http://framework.zend.com/issues/browse/ZF-7940
You can simply create another zf project in a different directory and copy the xml file into the the folder where it's missing. in the xml file, everything is relative, so you don't have to worry about the newly dummy project's path and others.

Categories