How can I contribute to a third-party Symfony bundle? - php

I'm trying to add a missing feature to a bundle. Here is what I've done so far:
Spoke to the project owner and got their approval
Created a fork and cloned it locally into a directory outside of my project
Made a feature branch
Ran composer install
Now, the question is, how can I include this into my own Symfony project so that it would be autoloaded? I want to test my changes inside my own project before I send a pull request.

See How to require a fork with composer, to be specific, require a VCS repository as described in Composer docs
Or a bit faster way for improving developing process (which is independent on Github), try using local repositories.

You can archive in two manner:
You can hack the vendor folder replacing the folder of the bundle with a symlink of the third-party bundle
[RECOMENDED] Put in the composer.json file of your project the reference of your personal github project instead of the official version

Related

Laravel 5 Package Development GIT setup

I have some great code I want to share....so I am moving code from my laravel 5 app into individual packages for use through composer/packagist.
This will also allow me to separate out code I only want in development and avoid deployment of nasty database modification classes to production.
I am confused on setting up git. My main project is running on a git repository. I am developing the packages under a sub-folder named packages/myname/package_name1/ . Each package is going to want its own git repository.
Should I add the folder "packages" to my .gitignore file for my main repository, then set up a git repository for each subfolder?
I followed this tutorial: Setup Laravel 5 Package
If you're using composer/packagist then yes, you should add the folder packages to .gitignore on your main repository. When deploying the entire application or when updating a package you'll have to do a composer install/update to keep everything up to date.

Laravel 5 setup git repo for multiple developers

I've done lot of Google but still looking for solution, I'm working on Laravel5 project & wants to set it up with GitHub so multiple developer can work on it.
I've install Laravel & place in a repository on Git, Now I cloned it on my local machine & another developer also clone that repository in his machine and start working.
But issue is that, I have installed a package for HTML forms in my machine by composer & push my code to github. But when another developer pull the repository then his code is break because composer.js is updated for that package but actually that HTML package is not exists on his machine.
Can anyone help me to short out this, or is there any way so we ignore vendor folder, composer.js, app.php etc files during git Push?
To answer your question specifically, yes you could choose to ignore the vendor folder, composer.json and app.php files when you push to git. To do this, you would simply need to update your .gitignore file to reflect this. I.e, include these in your .gitignore:
/vendor
composer.json
/config/app.php
But then the next question is whether you really want to do this, as doing so would mean that changes you make - and any subsequent pushes - may not be compatible with work the other developer is doing down the track.
If you exclude the /vendor file and the /config/app.php file but leave the composer.json file in there now that the other developer already has a copy of the core files, the updated composer.json file they download would allow them to use composer install to update the project with the new package.
However all of this would be problematic for a developer who joins you down the track and doesn't have any of the current files.

What is the best way to store Symfony project on github?

I've created a Symfony project and pushed it to the github. Now I want to get it from github on another machine.
The problem is that there are a lot of files/folders in Symfony's .gitignore file by default, so my application is broken after 'git clone' command.
I would like to know, what is the best way/practice to store and retrieve Symfony application on/from github. What are the common steps to do it?
You have to download and install Composer on your server.
Keep your .gitignore as default and install your vendors on each cloning.
If your deployment isn't recurrent, you can do it manually by use :
composer install
after each cloning .
If you deploy recurrently or just if you want, you can automate your deployment using Capistrano tasks for Symfony2

Laravel: Working with a 3rd party bundle

This is a basic best practice question.
I started my first project using the Laravel framework. I just recently added the L4withSentry bundle to my laravel project. I followed the setup steps and everything is up and running fine, but I noticed that all of the code that's running for the site is running from the vendor folder of my project even though I published all of the views and assets.
Should I leave all of the code in the vendor folder and customize it there? I'm under the understanding that if I update composer and any of the vendor files need to be updated I'll lose all of my code. Should I move the controllers into my app folder?
packages should stay in the vendor folder. the sentry package makes it actually easy to customize or set your own model outside of sentry, so you don't have to fiddle with vendor packages.
if you really have to change some behaviour in a vendor package, you'd create a new class extending that vendor package's class.

Zend Framework 2 and source code repository

We created a ZF2 project with skeleton app and it works fine for a simple test application. Now we are working on a real project. My question is what we should store in the repository (SVN), the whole project structure or just the new source code? ZF2 comes with a vendor directory which is almost 31MB in size (which has the ZF libraries). Should we store the whole vendor folder in SVN?
This is the first time we are using PHP and ZF so are not clear in how we will deliver the complete project to production from SVN. Also what is the build process if at all exists. Any clues/links to "ZF2 project packaging" is appreciated.
No, don't include dependencies in your repository! Putting your dependencies under version control doesn't do any good, it just blows up your repo for no reason.
You want to add the skeleton to your repository and your own library but definitely not the framework or any other dependencies.
The way to go is to use composer for dependency installation and some kind of build tool like Phing to automate installation of your project.
See the relevant chapter on phptherightway for more information on how to build your application.
The most simple build process doesn't even need a build tool
checkout your project from SVN/git
run php composer.phar install to install the needed dependencies (defined in your composer.json)
But most probably you want to do some more stuff like setup up the environment, deleting some files, etc.
A word about ZF packages. They're not available from packagist but you can install them with composer anyways. You just have to add the dedicated repository to your composer.json as described here: http://framework.zend.com/downloads/composer

Categories