{"id":15525659,"url":"https://github.com/sinnbeck/laravel-served","last_synced_at":"2025-04-14T03:20:40.808Z","repository":{"id":56477131,"uuid":"292824020","full_name":"sinnbeck/laravel-served","owner":"sinnbeck","description":"Docker version of artisan serve (with alot more)","archived":false,"fork":false,"pushed_at":"2020-11-05T10:31:27.000Z","size":418,"stargazers_count":74,"open_issues_count":6,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T03:53:12.308Z","etag":null,"topics":["docker","laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinnbeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-04T10:52:53.000Z","updated_at":"2024-09-10T15:54:29.000Z","dependencies_parsed_at":"2022-08-15T19:31:03.918Z","dependency_job_id":null,"html_url":"https://github.com/sinnbeck/laravel-served","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinnbeck%2Flaravel-served","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinnbeck%2Flaravel-served/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinnbeck%2Flaravel-served/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinnbeck%2Flaravel-served/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinnbeck","download_url":"https://codeload.github.com/sinnbeck/laravel-served/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248814038,"owners_count":21165667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","laravel","php"],"created_at":"2024-10-02T10:59:28.124Z","updated_at":"2025-04-14T03:20:40.786Z","avatar_url":"https://github.com/sinnbeck.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"Laravel Served\" src=\"https://github.com/sinnbeck/laravel-served/raw/master/logo.png?version=1\"\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sinnbeck/laravel-served.svg?style=flat)](https://packagist.org/packages/sinnbeck/laravel-served)\n[![Downloads on Packagist](https://img.shields.io/packagist/dt/sinnbeck/laravel-served.svg?style=flat)](https://packagist.org/packages/sinnbeck/laravel-served)\n![tests](https://github.com/sinnbeck/laravel-served/workflows/tests/badge.svg)\n\n# Introduction\n\nLaravel Served is a dockerized version of `php artisan serve`. It makes it easy to quickly start a development environment the laravel way (through a config file).\n\nThe only things you need to get started is\n* Php (cli)\n* Docker\n* Laravel\n\n\u003eBeware: This package is under active development and major changes can occur at any point. It is therefore a good idea to read the documentation, and republish the config file after each new version.\n\n## Available services\nThese are the available services that Served provide. More will be added in the future. If you are missing something specific, just create a new issue, requesting it.\n* Php\n* Nginx\n* Apache2\n* Mysql\n* Postgres\n* Redis\n* Memcached\n* Mailhog\n\n## Installation\nInstall the package using composer\n```\n$ composer require sinnbeck/laravel-served --dev\n```\n\n## Running for the first time\nIt is possible to just start a development server right away after installation. This will bring up 3 docker images:\n\n|Image|Version|Misc|\n|-----|-------|------|\n|Php-fpm|7.4|Preinstalled with composer, required php modules for running laravel and xdebug running on port 9000 with IDE key 'served'|\n|Nginx|1.19|N/A|\n|Mysql|5.7|\u003cul\u003e\u003cli\u003eHostname: mysql\u003c/li\u003e\u003cli\u003eDatabase: laravel\u003c/li\u003e\u003cli\u003eUsername: laravel\u003c/li\u003e\u003cli\u003ePassword: password\u003c/li\u003e\u003c/ul\u003e|\n\nTo start the containers simply run\n```\n$ php artisan served:up\n```\nIf this is your first time running the command, it will build the images first before starting the containers. If you have run the `served:up` command before, docker will quickly check the images for updates and served will start the containers again.\n\n## Starting and stopping served\nAfter your first run, you can easily start and stop your containers without having to build either images or containers. Simply run\n```\n$ php artisan served:start\n```\nAnd to stop the containers again without removing anything. \n```\n$ php artisan served:stop\n```\nThis is useful to free up ports if you have several projects using the same.\n\n## Ssh\nTo go into a container to work you can run\n```\n$ php artisan served:ssh container_name\n```\nThe `container_name` is optional, and will default to php (where you can run artisan etc.).\n\n\u003eServed doesn't actually ssh into the container, but rather just start a bash shell directly. `served:ssh`just sound better and is quick to type.\n\n## Clean up\nIt is possible to remove all data set up by served. To do this simply run\n```\n$ php artisan served:teardown\n```\n\n## Configuration\nWhile it is possible to just run served without any configuration, it is probably a good idea to configure served for your needs.\nTo get started you need to publish the config file.\n```\n$ php artisan vendor:publish --provider=\"Sinnbeck\\LaravelServed\\ServedServiceProvider\"\n```\n### Name\nTo avoid naming conflicts between projects, you can define your own name for served configuration. This name will be used when creating network, images and containers. Make sure it is unique between projects! If no name is set, served will use the folder name of the laravel installation (a slug version)\n\nIt is important the name only consists of letters, numbers, `.`, `-` and `_`. Other special characters will throw an exception.\n\nIf you at some point wish to chance the name after having used served on a project, it is important to teardown both images and containers using `served:teardown`. If you have already changed the name and are having issues getting your containers up and running with the new name, just chance the name back, run teardown, and set it to the new name once more.\n\n### Php\nHere you may specify how php should be built. Any options left blank or removed will be defaulted to using the defaults provided by served.\n\n```\n'php' =\u003e [\n        'version' =\u003e env('SERVED_PHP_VERSION', '7.4'),\n        'modules' =\u003e [\n            'pdo_mysql',\n            'zip',\n        ],\n        'npm' =\u003e true, //enable or disable npm in build\n        'xdebug' =\u003e [\n            'enabled' =\u003e env('SERVED_XDEBUG_ENABLED', true),\n            'port' =\u003e 9001,\n        ],\n    ],\n```\n\nThe array of modules can be filled with any module found in the url below (except parallel, pthreads and tdlib) \n\nhttps://github.com/mlocati/docker-php-extension-installer\n\n#### Xdebug\nIt is suggested to install xdebug to make debugging easier. To install it and set it up, simple make sure it is set as enabled in the config, while running `php artisan served:up php`\n\nAs Xdebug can slow down requests, it is possible to quickly turn it off and on, when needed.\n\nEnable Xdebug\n```\n$ php artisan served:xdebug enable\n```\nDisable Xdebug\n```\n$ php artisan served:xdebug disable\n```\nInteractive toggle Xdebug\n```\n$ php artisan served:xdebug\n```\nBe aware that you need to run `php artisan served:up php` again if you decide to enable Xdebug in the config. It isn't possible to toggle it on an off if it isn't installed in the first place.\n\n### Web\nServed currently supports nginx and apache. Simply service to whichever you want to use, and set the correct version (or delete the version to have served use a sensible default). Apache currently only supports the latest version and will ignore any version set.\n\n```\n'web' =\u003e [\n        'service' =\u003e 'nginx', //or apache\n        'version' =\u003e '1.9.2',\n        'port' =\u003e env('SERVED_WEB_PORT', 8095),\n        'ssl_port' =\u003e env('SERVED_WEB_SSL_PORT', 4443),\n    ],\n```\nIf you are trying to use the https address, you will be shown a certificate error. To fix this in Chrome, open chrome://settings/certificates and select the Authorities tab. Click import and find the `localhost.crt` in your `/storage/app/served/web/` directory\n\n## Extras\nHere you can define extra images that you wish to run. The array key is used as name, meaning it is possible to run the same service more than once, with different names (eg. two mysql instances).\n\nThe current supported images are:\n\n### Mysql\nPort is used for when connecting to mysql from outside of laravel. \nEg. 127.0.0.1:3306. \n\nTo connect to the database from laravel you need to use the config key (in the example that would be `mysql`) as hostname. The port is the default for mysql (3306) and not the one specified in the config.\n\nIf you wish to override the port you use connect to mysql from outside your docker, you can do so by adding 'SERVED_EXTERNAL_DB_PORT' to your .env \n```\n'mysql' =\u003e [\n            'service' =\u003e 'mysql',\n            'version' =\u003e '5.7',\n            'port' =\u003e env('SERVED_EXTERNAL_DB_PORT', 3306),\n            'root_password' =\u003e 'password',\n            'database' =\u003e env('DB_DATABASE', 'laravel'),\n            'username' =\u003e env('DB_USERNAME', 'laravel'),\n            'password' =\u003e env('DB_PASSWORD', 'password'),\n        ],\n```\n\n### Postgres\nTo connect to postgresql from laravel you need to use the config key (in the example that would be `postgres`) as hostname. The port is the default for mysql (5432) and not the one specified in the config. To connect from outside of laravel, use the port specified in the config (eg. 54320) and 127.0.0.1\n```\n'postgres' =\u003e [\n            'service' =\u003e 'postgres',\n            'version' =\u003e '12.4',\n            'port' =\u003e 54320,\n            'database' =\u003e 'laravel',\n            'username' =\u003e 'laravel',\n            'password' =\u003e 'password',\n        ],\n```\n\n### Redis\nAdd redis to the modules in php and then add redis to your extras array.\n```\n'redis' =\u003e [\n            'service' =\u003e 'redis',\n        ]\n```\nChange your `REDIS_HOST` in .env to whatever you use as the key (eg. redis)\n\n### Memcached\nAdd memcached to the modules in php and then add memcached to your extras array.\n```\n'memcached' =\u003e [\n            'service' =\u003e 'memcached',\n        ]\n```\nChange your `CACHE_DRIVER` in .env to `memcached` and add `MEMCACHED_HOST` and set it to whatever you use as the key (eg. memcached)\n\n### Mailhog\nAdd mailhog to your extras array.\n```\n'mail' =\u003e [\n            'service' =\u003e 'mailhog',\n            'port' =\u003e 8025\n        ]\n```\nChange your `MAIL_HOST` in .env to whatever you use as the key (eg. mail), and change `MAIL_PORT`to 1025. To see the mailbox, open http://localhost:8025 in your browser (replace 8025 with whatever port you set in config)\n\n## Testing\nRun tests with \n```\n$ composer test\n```\n\n\n## Todo\n- [ ] Testing!\n- [ ] Add more images\n- [ ] Allow user created services\n- [ ] Let served make a proper name if none is set (instead of defaulting to 'served')\n- [ ] Handle setting/adding volumes\n- [ ] Handle removal of volumes\n- [ ] Handle upgrades/downgrades of images\n- [ ] Pass cli output interface to other classes to allow outputting to cli from them\n- [x] Test on other platforms than linux (Ubuntu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinnbeck%2Flaravel-served","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinnbeck%2Flaravel-served","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinnbeck%2Flaravel-served/lists"}