PHP-Invest is a self-hosted stock portfolio tracking software based on PHP/Symfony framework. It can track portfolios across multiple brokers and show them in a unified interface. Daily price data can be automatically downloaded from multiple online sources for charting.
After many unsuccessful searches for existing self-hosted open source stock portfolio tracking applications, the idea for PHP-Invest was born. Commercial/Free portfolio tracking services often are limited in their functionality and it is not possible to extend them.
For usage documentation, see:
This project is under active development. New features will be added with a priority on function over design and tracking trades over analysis. However, tracking of trades has reached a certain stability which will allow entering trades for later analysis.
The following features are already supported and have reached a usable stability:
Missing features:
To install, first clone the git repository and execute the following commands:
composer install --no-dev
(this will automatically install npm
modules)php bin/console doctrine:database:create
php bin/console doctrine:schema:create
.env.local
file (same format as .env
) where you define at least a custom APP_SECRET
(e.g. APP_SECRET='My$ecret'
)php bin/console doctrine:fixtures:load -n
(requires dev or test environment)By default, a sqlite database is created. In order to override this behavior, create a copy of .env
as .env.local
and modify your configuration.
So far, only standard Symfony configurations are used. Please refer to the symfony/doctrine documentation for details.
In order to use the web-app, your webserver needs to publish the php-invest/public
folder.
For a quick demo, you can build a docker image using
docker build -t phpinvest:latest .
and run a non-persistent demo system using
docker run -it --rm -p 8000:8000 phpinvest:latest
You will be greeted with a login page.
In order to log in, you need to create a new user using the Administration -> New user
menu item.
Note that this docker image uses the built-in php webserver and is not suited for a production environment.
In order to execute unit tests, you need to prepare your environment and test-database. Since we populate the database with test-data, it is important to always set up a new database after any update to have predictable auto-increment keys.
cd <directory where php-invest is cloned>
composer install
bin/console --env=test doctrine:database:drop --force # Only in case there is an old version
bin/console --env=test doctrine:database:create
bin/console --env=test doctrine:schema:create
bin/console --env=test doctrine:fixtures:load -n
bin/phpunit # Runs the actual PHP unit tests
When updating the source code to a new version, the database schema might have changed. Usually, an upgrade can be performed without migration scripts using standard console commands. Currently, migration scripts are not maintained as there is no official Release yet. Please open an Issue if there are problems when migrating your data. As always, make sure to backup the database before any upgrade or migration operation.
The upgrade procedure looks as follows:
cd <directory where php-invest is cloned>
git pull
composer install --no-dev
bin/console doctrine:schema:update --dump-sql # Optional step to find out what will change (no execution yet)
bin/console doctrine:schema:update --force # Perform the upgrade
PHP-Invest is maintained by Matthias Straka. Contributions and bugfixes are welcome via pull-requests.