• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
  • License
    MIT License
  • Created over 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker image for a php-fpm container crafted to run Laravel based applications.

PHP-FPM Docker image for Laravel

Docker image for a php-fpm container crafted to run Laravel based applications.

Specifications:

  • PHP 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1 / 7.0 / 5.6 / 5.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • SOAP PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • PCNTL PHP Extension
  • ZIP PHP Extension
  • GD PHP Extension
  • BCMath PHP Extension
  • GMP PHP Extension
  • Intl PHP Extension
  • Imagick PHP Extension
  • Memcached
  • Composer
  • Laravel Cron Job for the task scheduling setup
  • PHP ini values for Laravel (see laravel.ini)
  • xDebug (PHPStorm friendly, see xdebug.ini)
  • t alias created to run unit tests vendor/bin/phpunit with docker-compose exec [service_name] t
  • d alias created to run Laravel Dusk browser tests artisan dusk with docker-compose exec [service_name] d
  • art alias created to run the Laravel artisan command
  • fresh alias created to migrate the database fresh and seed the seeders artisan migrate:fresh --seed

Tags available:

When calling the image you want to use within your docker-compose.yml file, you can specify a tag for the image. Tags are used for various versions of a given Docker image.

Note: the master branch is not used for generating images, used for documentation instead. Only tags/branches are.

docker-compose usage:

version: '2'
services:
    php-fpm:
        image: cyberduck/php-fpm-laravel(:<version-tag>)
        volumes:
            - ./:/var/www/
            - ~/.ssh:/root/.ssh # can be useful for composer if you use private CVS
        networks:
            - my_net #if you're using networks between containers

Xdebug usage:

The image comes with Xdebug installed but by default it is disabled. Xdebug can be enabled using an environmental variable. This can either be done using the .env file, passing the envs using docker or passing the envs using docker-compose.

Using .env file

Add the following to the env file and then start/restart the container.

XDEBUG=true
PHP_IDE_CONFIG="serverName=phpstorm-server" # This is required for PhpStorm only for path mappings
REMOTE_HOST="<HOST_IP>" # If not set the default is 'host.docker.internal' which will work on OSX and windows

Using docker

Pass the required variables with the run command using the -e option.

docker run -d \
    -e XDEBUG=true \
    -e PHP_IDE_CONFIG="serverName=phpstorm-server" \ #This is required for PhpStorm only for path mappings
    -e REMOTE_HOST="<HOSTIP>" \ # If not set the default is 'host.docker.internal' which will work on OSX and windows
    -v /root/of/project:/var/www \ 
    -v ~/.ssh:/root/.ssh \
    cyberduck/php-fpm-laravel(:<version-tag>)

Using docker-compose

Pass the variables in the environment section of the service using this image.

version: '2'
services:
    php-fpm:
        image: cyberduck/php-fpm-laravel(:<version-tag>)
        environment:
            XDEBUG: true
            PHP_IDE_CONFIG: "serverName=phpstorm-server" #This is required for PhpStorm only for path mappings
            REMOTE_HOST: "<HOSTIP>" # If not set the default is 'host.docker.internal' which will work on OSX and windows
        volumes:
            - ./:/var/www/
            - ~/.ssh:/root/.ssh # can be useful for composer if you use private CVS
        networks:
            - my_net #if you're using networks between containers

PhpStorm configuration

For xdebug to work with PhpStorm you will need to create a server. This can be done by going to Preferences > Languages & Frameworks > PHP > Servers and then follow the steps below.

1, Click the + symbol.

2, Create a name for the server. This will be the value of serverName in the PHP_IDE_CONFIG variable e.g PHP_IDE_CONFIG="serverName=<CONFIGURED_SERVER_NAME>".

3, Set Host to http://localhost or if using a virtual host then use that instead e.g http://myapp.localhost.

4, Set the port to the port that is being used on the host machine e.g 80.

5, Set the debugger to Xdebug.

6, Check the Use path mappings checkbox.

7, Under the project files section find the root of the project and on the right hand side fill out its location inside the container e.g /var/www.

8, Click apply and close preferences.

9, Start listening for incoming connections by going to Run > Start listening for PHP debug connections

10, Xdebug can now be tested by adding a breakpoint or selecting Run > Break at first line in PHP scripts and refreshing the browser.

Visual studio code configuration

For Xdebug to work in Visual Studio Code a launch.json will need to be added to .vscode folder in the route of the project. Please see below for an example of a launch.json file

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/var/www": "${workspaceFolder}"
            }
        }
    ]
}

Once this has been added then you can navigate to the debug section. On the left hand side under the BREAKPOINTS section uncheck the Everything checkbox. Now from the dropdown menu at the top select listen for Xdebug then press the play button.

Xdebug can now be tested by adding a breakpoint and refreshing the browser.

More Repositories

1

laravel-wp-api

Laravel package for the Wordpress JSON REST API
PHP
129
star
2

hoisin.scss

A simple responsive mini framework to kick start your project.
SCSS
90
star
3

Silverstripe-SEO

A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content
PHP
44
star
4

Laravel-Google-Tag-Manager

Google Tag Manager tracking module for Laravel
PHP
16
star
5

Silverstripe-Google-Tag-Manager

Google Tag Manager integration for SilverStripe
PHP
15
star
6

ti-fingerprint-identity-boilerplate

Boilerplate for Axway Appcelerator Titanium Alloy applications using Apple Touch ID and Google Fingerprint implementations.
JavaScript
15
star
7

Pardot-API

PHP package to interact with the Pardot API
PHP
14
star
8

Silverstripe-Block-Page

A modular approach to building pages in SilverStripe
PHP
14
star
9

ti-drawer-boilerplate

A boilerplate for an Appcelerator Alloy application using a Drawer layout and Window stack nav logic.
JavaScript
14
star
10

Silverstripe-Blacklist

Block and track access to your SilverStripe application based on IP, referer, or host
PHP
13
star
11

Silverstripe-Social-Sharer

Social sharing widget for SilverStripe
PHP
12
star
12

alloy-toast-notification

Simple toast notification poping from the bottom of the screen on demand.
JavaScript
11
star
13

Silverstripe-X-Framer

Set X-frame headers based on user IP on your SilverStripe application
PHP
10
star
14

Front-end-build-system

Gulp and package files for Silverstripe and Laravel 5+ from end processing
JavaScript
7
star
15

referer-tracker

Track the referer path for visitors in silverstripe
PHP
6
star
16

alloy-select-listview

A Ti.UI.ListView wrapper with mighty powers for forms.
JavaScript
6
star
17

proftpd-mysql

ProFTPD Base Image including MySQL database authentication support
Dockerfile
6
star
18

CyberDuck-vQmods

A collection of vQmods for Opencart
6
star
19

Mail-Grasp

This package adds support for email testing in a Laravel application (>5.0)
PHP
5
star
20

opencart-sentry-raven-whoops

Integrate the Raven Sentry client and Whoops error handling into Opencart
PHP
5
star
21

SilverStripe-Recaptcha

Standard reCAPTCHA and invisible reCAPTCHA form fields for SilverStripe
PHP
4
star
22

laravel-zoopla

Laravel package for the Zoopla API
PHP
4
star
23

Silverstripe-LinkItemField

SilverStripe 4 custom form element and model for anchor, email, telephone, file, image, internal and external links
PHP
4
star
24

Sagepay-template

A responsive template sample for SagePay
XSLT
3
star
25

Trial-by-front-end

JavaScript
3
star
26

Silverstripe-Migration

Library to migrate a database to Silverstripe and convert columns where needed to Silverstripe relations
PHP
3
star
27

white-opencart

OpenCart Extension for White payments
PHP
3
star
28

seeder-generator

Generate seeders from the Telescope entries table
PHP
3
star
29

Silverstripe-Login-Protection

SilverStripe login with Google recaptcha and time based user blocking based on incorrect login attempts
PHP
3
star
30

Laravel-Alternative-Mailer

This package allows a Laravel to send emails through two different mail configurations.
PHP
3
star
31

sublime-ti-alloy-related

A Sublime Text 3 plugin to easily navigate around your Titanium Alloy application source code.
Python
3
star
32

SilverStripe-Searchly

Elastic Search integration for SilverStripe
PHP
2
star
33

laravel_maxmind_geolocate

PHP
2
star
34

Duck-Alert

Fuse app to check website status
JavaScript
2
star
35

mobile-first-prototypes

Mobile first templates for creating responsive prototypes using Axure RP 7
JavaScript
2
star
36

sentry-raven-laravel3-bundle

PHP
2
star
37

cacheing-memoizer

PHP
2
star
38

fluent-debug

Helper for using xDebug breakpoints with method/function chaining
PHP
2
star
39

laravel-cacheing-memoizer

Laravel Service Provider for cyber-duck/cacheing-memoizer
PHP
2
star
40

laravel-address-finder

PHP
2
star
41

terraform-aws-s3-access

A Terraform module to give access to S3 for specific users. This module allows the user to create users and groups with the option of using existing. The group will have granular S3 access policy attached with the option to add additional policy(s) if required.
HCL
2
star
42

pdfnet-php

PDFNetPHP Library generated by SWIG for PHP 5.6.30 for PDFTron
PHP
2
star
43

DevOps

1
star
44

laravel-rest-routes

PHP
1
star
45

php-fpm-expression-engine

1
star
46

php-fpm-silverstripe

Docker image for a php-fpm container crafted to run SilverStripe based applications.
1
star
47

Silverstripe-Pardot

Pardot integration for SilverStripe
PHP
1
star
48

Salesforceapi

PHP
1
star
49

CI-HarvestAPI-Spark

CodeIgniter Spark Harvest API
1
star