PHP HTML Makefile CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
bin
config
public
resources/stats
src
templates
tests
.dockerignore
.gitignore
.php_cs.dist
.travis.yml
Dockerfile
Dockerfile.dev
LICENSE
Makefile
README.md
composer.json
composer.lock
docker-compose-dev.yml
docker-compose-test.yml
docker-compose.yml
entrypoint.sh
nginx.conf
package-lock.json
package.json
phpunit.xml.dist
symfony.lock
webpack.config.js

README.md

uh.cx url shortener

Build Status Coverage Status

This is a link shortener based on Symfony 4 and PHP 7.1. It brings its own Docker environment so you can start immediately. See uh.cx for a demonstration, get the source code on github.

Features

  • JSON API
  • Google Analytics integration
  • EU cookie warning
  • RSS Feed about the generated links
  • Administration interface

Installation

Execute the following command to start the container. Keep in mind that you have to change the MySQL credentials.

docker run \
    -d --name=uhcx \
    -e MYSQL_HOST=yourmysql.host \
    -e MYSQL_DB=mysqlDatabaseName \
    -e MYSQL_USER=username \
    -e MYSQL_PASSWORD=secret \
    -e VIRTUAL_HOST=uh.cx,preview.uh.cx \
    --restart=always \
    -m 128M \
    jeboehm/uh.cx:latest

In addition you need a reverse proxy in front of the app. I recommend jwilder/nginx-proxy.

Set up the default site by issuing the following command:

docker exec -it uhcx bin/console site:create YourSitesName uh.cx preview.uh.cx

Security

The following uri's should be protected by your webserver configuration:

  • /admin
  • /feed

Configuration

Google Analytics

The app supports Google Analytics. To enable the integration pass the environment variable GA_TRACKING=UA-XXXXX-1 to the container.

Enable / disable EU cookie warning

If you need the EU cookie warning feature, set the environment variable COOKIE_WARNING to true.

Development

Requirements:

  • Docker
  • NPM
  • PHP
  • docker-sync

The development environment can be set up by using make:

make dev # Build the development image (contains Xdebug), start up MySQL + App, start docker-sync.
make clean # Completely delete the development environment.

Other commands

make build # Build Docker image for production from scratch.
make test # Start up an test environment, execute PHPUnit and delete the environment afterwards.
make coverage # Start up an test environment, execute PHPUnit and build code coverage reports.
make assets # Execute NPM and Grunt to build the public asset files.
make commit # Format the source code.