How can multiple projects easily depend on the same set of public code? I am new to PHP development and want to develop a website. I plan to split it into several projects:
Project. core, project. frontend, project. backend, project. api
In the following several projects, we need to use the common models and helper functions in core projects. how can we achieve this easily? Except for directories that are manually copied: (IDE is zend studio)
Thank you.
Reply to discussion (solution)
If a project (a website you are talking about) is split into several modules (similar to several of your projects), public items should be put forward into a single file, each module can call
If there are several separate projects (independent websites), you 'd better copy them by yourself.
If a project (a website you are talking about) is split into several modules (similar to several of your projects), public items should be put forward into a single file, each module can call
If there are several separate projects (independent websites), you 'd better copy them by yourself.
Thank you. we want to build a platform. we plan to split it into three websites, corresponding to three sets of project files, the front-end part of the website used by users, and our own internal management system, there are also website APIs that use the same library and focus on the same business. a lot of code is generic. if every project has its own set and there are so many repeated codes, the maintenance workload is too heavy.
In the past, I used a compilation language like java and. net. I only needed to reference the compiled jar or dll. I was not very familiar with php. Just now I thought of a tool that could automatically synchronize the entire folder. I feel good at acrobatics...
The three projects you mentioned are actually a website. they can be under a website directory, so they can share code and be recommended.
You can introduce a public php file (require) at the entry file of each project.
Or you can import
If your site directory contains the following files (folder): admin web api common index. php
Introduce the public php file in common in index. php, and then go to admin or web or api
Of course you can. just include it.
You just need to clarify the business logic. Include only common parts
Okay. thank you for your answers. let me try again :)