4

I need to develop several websites with common features and flows, the only thing that will dramatically change is the CSS, even the HTML will be common.

I'm having troubles to assemble this structure in Laravel 4, since I'm still a begginer at the framework.

  • I need to have a "super project" that all "sub projects" will inherit from.
  • I need to be able to implement custom features and flows in a specific "sub project".
  • I need to separate every project in it's own GIT repository.

I would love to have an opinion of someone who already had to create such structure.

Thanks in advance!

2
  • I would say to use subdomains to control sub projects, but separating those sub-projects into GIT would be difficult. I'm definitely interested to see any answers that come up. Commented Mar 10, 2014 at 18:36
  • I would follow the module based app management like the one in Django for python. Commented Mar 16, 2014 at 14:27

2 Answers 2

4
+50

You can use package feature, first of all you need to make a kernel package as your basic project and then extends 'sub projects' from your git repository, it's easy way, as Laravel introduction says:

"Packages might be anything from a great way to work with dates like Carbon, or an entire BDD testing framework like Behat."

With packages you can single out each feature on composer.json and load them one by one.

Sign up to request clarification or add additional context in comments.

1 Comment

I'll try it and then come back with the feedback. Thanks!
1

Assuming that the separate Git repos is required, one approach could be to have an "app" folder for each project plus one for the main project. I.e.:

  • App
  • Subapp1
  • Subapp2
  • ...

Then you need to add an autoloader that checks if the given file is present in the subapp-folder. If not, then load from the app folder. This way you can centralize app files, but also create custom other files, or override app files via the subapp-folders. Each subapp folder can then be an individual Git repo, while the root folder excluding the subapp folders are the main repo.

Config and routing would be handled via the main app.

You could also add namespaces or a similar folder end structure to control in more detail what functionality is customized by the subapps, without having to override an entire controller or model from the app.

3 Comments

I understood the idea, but I'm starting to think that maybe Laravel would not the best for the job. In Kohana, for example, I could create every sub project as a separate module, or something like that, I don't know..
Feels like I'll have some troubles to get this structure working in Laravel.
Good idea @menjaraz, I'll come back and post here if I find something useful. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.