Application project setup

The application I'm working on has the codebase structured like this:
- a "Base" application, that is a sort of cross between a library and a framework, with most common methods and generic classes.
- 4 applications that are built on top of the Base that have specific use cases.

Each one of these 5 "parts" have their own dependency configuration, test folder, root folder, settings, phpunit configuration and such.

The setup right now that makes everything work is a master dependency configuration that binds all the other ones and trick PhpStorm into thinking that is it only one big application.

It's easier to make changes all over the place this way, and have autocomplete and such, but this has a lot of side effects like confusing PhpStorm on which unit test folder to use, sometimes the master composer file is not updated well and all sort of this kind of issues.

We have to use multple phpunit xml configurations that force us to all sort of limitations on the way we can run tests

My approach to improve things would be to actually have a PhpStorm project for each of the 4 applications, and have the Base embedded into each of them as a library somehow, so the side effects are solved
The problem I have so far is that PhpStorm in th eproject will recognize composer of the application but not composer of the Base, so a few dependencies are not recognized. How do I fix this? What is the best way to embed the Base into the application project?

 

7 comments
Comment actions Permalink

Hi there,

If a "Base" is a library/framework ... then you may be able to use it as a composer package.

(On related note) kind of similar recent question on StackOverflow: https://stackoverflow.com/a/62831670/783119

1
Comment actions Permalink

Using it as a composer package would solve the dependency but we want to be able to make changes to the Base at the same time with the changes to the application. Adding the base as a Content root allows us to do that, but this means that the composer of the Base is not going to be read by PhpStorm and we will end up missing some features (some packages not being recognized). 

0
Comment actions Permalink

>we will end up missing some features (some packages not being recognized). 

Can you please clarify this moment? With screenshots please.

 

1
Comment actions Permalink

Looks like the problem is basically one. Unit tests that with the "current" setup run fine, with this new setup I'm trying give the following error: "Error : Class 'IntlDateFormatter' not found" and I'm trying to figure out why

0
Comment actions Permalink

Are you able to run those test outside PhpStorm successfully? What PHPUnit & IDE versions are you running?

1
Comment actions Permalink

PHPUnit 8.0.0

PHP 7.4.6 with Xdebug 2.9.6

PhpStorm 2019.3.2 Build #PS-193.6015.48, built on January 22, 2020

 

Unit tests run fine on command line, and also runs fine within PhpStorm if I use my current configuration (using a "supercomposer" to trick PhpStorm to think it's just one application when instead it's 4 + base).

With the new configuration I'm trying to make work (1 app + base, without supercomposer config) I get this error

0
Comment actions Permalink

Would it be possible to attach screenshots of "supercomposer" and "new configuration" phpunit configurations?

 

0

Please sign in to leave a comment.