Symfony 4 include another project from different directory - php

So, I have an application that consists of 5 different projects.
Each of the projects is a new Symfony 4 project, since I need to host them on separate domains.
My structure is like this:
Admin project: /var/www/html/admin
Client project: /var/www/html/client
Owners project: /var/www/html/owners
Each of the project has its own symfony skelet (src,public,config,bundles,public, etc...)
I know this can be done through bundle, but, what I want to do is to create a new Symfony project (Common) and use it accross all the others. Since ill be having same entities and same common services through projects, I need to include it in each of them.
Is there a way to include this Common project into all others and use services/entities from there?

Related

Files organization Symfony 3

I am starting a migration project from cakephp 2 to Symfony 3. I am trying to find the best organization for the different functions for my code.
In cakephp I have very simple organization: I used model, view and controller. On this point no problem with Symfony (same organization). But I also have 5 php libraries with only one or two function in each, and 3 object classes not linked to database. In cakephp all this files are in the Lib folder.
Where can I create and use this libraries and classes in Symfony (not in a new bundle)?

Finding a good structure for multiple apps in symfony2

This is the situation i am currently having issues with:
I have 1 webserver, this webserver must run 2 different websites, those websites are all written in symfony2 and share the same Bundle that i wrote.
Currently this bundle is placed in the src/ folder and loaded in the AppKernel.
Right now i am using the apps approach where i have 2 seperate app folders created in 1 folder called apps ( http://jolicode.com/blog/multiple-applications-with-symfony2 )
However right now my situation changed, i have this 1 webserver with 2 different websites but i also have a second webserver which must also be able to have multiple apps.
Both servers should not share the same configuration files which is having me a lot of difficulties with deploying.
I also want to prevent that i have to deploy unused bundles to a server.
I hope i explained everything as clear as possible, it is not easy to make a description.
As I read, the app folder contains all config or not files related to the app ( doctrine, Kernel, cache, logs, etc). Routing, Services or other files related to how works an specific bundle should be within that bundle in my opinion.
I think there is not a standard or good way to do this because symfony right know has the workflow one app - one project. Any structure which separates bundle config and app con
fig is valid if don't mix both kinds

Multiple apps / projects with one Laravel 4 installation

i'm have worked with laravel 3 in the past and used a project structure where multiple apps could use one installation of the framework. now in laravel 4 i am concered if that is still possible. since the bootstrap/autoload.php file requires the vendor/autoload.php file (and so on...), different apps have to use the same autoload files from within the vendor directory, right? i think this would be a big performance problem because the different apps maybe have different requirements, different models to work with and so on. am i thinking right or is there a chance to use one /vendor/ installation for multiple apps without the need to share the autoload files?
to explain my needs: i would like to run different apps (every app with another domain & home directory) which share one database and some models. but the requirements of every app will be very different.
is there any solution? i tried this since the release but found no practicable way.
Have you tried http://laravel.com/docs/routing#sub-domain-routing?
You could create a route group and assign a filter function to that route group to do specific autoloads?
How about modifying bootstrap/autoload.php and vendor/autoload.php to load autoload stuff per project to some kind of sub-directory structure under vendor/composer/.
Not sure, how to change composer to generate that kind of project specific autoload directories. Maybe it needs changing composer?

Symfony 2 and projects

Let's consider I have different projects for my company. What is the best practice concerning symfony 2 ?
1. Add new bundle for each project in the same symfony 2 skeleton (there could be several bundles for one project: even shared bundles between differents project)
2. Add a new Symfony 2 skeleton for one project (there could be several bundles for one project)
if way number 1 is acceptable, is there a maximum number of bundles for one symfony 2 skeleton ?
A Bundle is a logical component in your website like a backend or a menue. You should build your bundles global that you can use it in new projects.
I would prefer to make more instances and build bundles that were included in your projects (vendor folder). Then you have single components and can use it in new projects.
The advantage is that you can have different versions in different projects. Perhaps you need another version of a bundle in Project A and Project B. Thats its a bit complicated with one instance.
When need to scale your website its better to have more instances to put it on different servers. When you have only one instance with all projects then you need everytime the complete sources.
You can build your own composer packages to update and deploy over composer.
https://packagist.org/
I think there are some more package builder.

Symfony2 Multiple Projects

Can you direct me to some tutorials or helpful information regarding Symfony2 and common components among similar projects? I have two projects that will use a tremendous amount of the same code (mostly backend logic/user handling/checkouts), but there will be quite a different in the frontend templates, display and functionality.
Currently I have three folders with symlinks (Project 1, Project 2, and Symfony Base). Is this the best setup? Recommendations for doing it better?
Symfony 2 Bundles are what you want here. Wrap up all the stuff you want to share between projects in a bundle installed in to both - then build the project specific UI on top of it.
Would recommend on the Symfony 2 docs: http://symfony.com/doc/2.0/cookbook/bundles/index.html

Categories