PageSourceSearch

https://docs.phpvms.net/assets/js/01ccdc8c.9e49fedf.js

js phpvms.net collected 2026-10-04 13:24:50 UTC 9,347 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkphpvms_docs=self.webpackChunkphpvms_docs||[]).push([[5492],{38430(e,n,t){t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>a,toc:()=>d});const a=JSON.parse('{"id":"developers/environment","title":"Environment Configuration","description":"This is for running a local configuration, for running unit-tests, etc.","source":"@site/docs/developers/environment.md","sourceDirName":"developers","slug":"/developers/environment","permalink":"/8.x/developers/environment","draft":false,"unlisted":false,"editUrl":"https://github.com/phpvms/docs/tree/master/docs/developers/environment.md","tags":[],"version":"current","frontMatter":{"id":"environment","title":"Environment Configuration"},"sidebar":"docs","previous":{"title":"Reference","permalink":"/8.x/acars/plugins/reference"},"next":{"title":"Overview","permalink":"/8.x/developers/addons/overview"}}');var s=t(74848),i=t(28453);const o={id:"environment",title:"Environment Configuration"},r="Environment Configuration",l={},d=[{value:"Disable Caching",id:"disable-caching",level:3},{value:"Laravel Documentation",id:"laravel-documentation",level:3},{value:"Creating and Resetting the Environment with docker",id:"creating-and-resetting-the-environment-with-docker",level:2},{value:"Resetting the Environment",id:"resetting-the-environment",level:3},{value:"Updating",id:"updating",level:3},{value:"Without Docker",id:"without-docker",level:2},{value:"Laravel Valet",id:"laravel-valet",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"environment-configuration",children:"Environment Configuration"})}),"\n",(0,s.jsx)(n.p,{children:"This is for running a local configuration, for running unit-tests, etc."}),"\n",(0,s.jsxs)(n.admonition,{type:"note",children:[(0,s.jsx)(n.p,{children:"This is just how I work on phpvms, to quickly reset the database and\ntest/develop items locally, without having to transfer files anywhere. I mainly\nuse the Docker Compose setup"}),(0,s.jsxs)(n.p,{children:["If you're on Windows, I highly recommend installing WSL with your distro of\nchoice (I use Ubuntu). If you don't have ",(0,s.jsx)(n.code,{children:"make"})," available, open the ",(0,s.jsx)(n.code,{children:"Makefile"}),"\nand look for the commands to run for the individual commands of what you're\ntrying to run."]})]}),"\n",(0,s.jsx)(n.h3,{id:"disable-caching",children:"Disable Caching"}),"\n",(0,s.jsxs)(n.p,{children:["You may want to disable caching during development phases to ensure your changes\nare applied correctly, as caching cna prevent changes from taking effect. To do\nthis, set ",(0,s.jsx)(n.code,{children:"CACHE_DRIVER=null"})," in your ",(0,s.jsx)(n.code,{children:".env"})," file."]}),"\n",(0,s.jsx)(n.h3,{id:"laravel-documentation",children:"Laravel Documentation"}),"\n",(0,s.jsxs)(n.p,{children:["We strongly recommend reading the\n",(0,s.jsx)(n.a,{href:"https://laravel.com/docs/10.x",children:"Laravel Documentation"}),", as it's more detailed\nand up-to-date. Since phpvms is based on Laravel, the installation process is\nthe same. In addition, you can simply use the ",(0,s.jsx)(n.code,{children:"php artisan phpvms:dev-install"}),"\ncommand to set up a development database."]}),"\n",(0,s.jsx)(n.h2,{id:"creating-and-resetting-the-environment-with-docker",children:"Creating and Resetting the Environment with docker"}),"\n",(0,s.jsxs)(n.p,{children:["We are using ",(0,s.jsx)(n.a,{href:"https://laravel.com/docs/10.x/sail#main-content",children:"Laravel Sail"}),"\nwhich provides a simple way to set up and manage a local development environment\nfor laravel apps using Docker."]}),"\n",(0,s.jsx)(n.p,{children:"Before you begin, ensure you have docker installed on your system"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:'git clone https://github.com/nabeelio/phpvms.git phpvms\ncd phpvms\ndocker run --rm \\\n    -u "$(id -u):$(id -g)" \\\n    -v "$(pwd):/var/www/html" \\\n    -w /var/www/html \\\n    laravelsail/php83-composer:latest \\\n    composer install --ignore-platform-reqs\n\n./vendor/bin/sail up -d\n./vendor/bin/sail artisan phpvms:dev-install\n'})}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"phpvms:dev-install"})," command creates the ",(0,s.jsx)(n.code,{children:".env"})," config file. It will then\nrun the migrations, and install the sample seed data, which is located in\n",(0,s.jsx)(n.code,{children:"app/Database/seeds/sample.yml"})]}
1),"\n",(0,s.jsx)(n.p,{children:"Then to reset the database and reinstall the dev data:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"./vendor/bin/sail artisan phpvms:dev-install --reset-db\n"})}),"\n",(0,s.jsxs)(n.p,{children:["This does require sqlite. If you want to use MySQL, you need to run the phpvms\ninstaller, so it can generate the config files for MySQL (or you can modify the\ngenerated ",(0,s.jsx)(n.code,{children:".env"}),"), then you can run the above command to reset the database and\nmigrations in MySQL."]}),"\n",(0,s.jsx)(n.h3,{id:"resetting-the-environment",children:"Resetting the Environment"}),"\n",(0,s.jsx)(n.p,{children:"To reset the database/clear cache, use this command."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"./vendor/bin/sail artisan database:create --reset\n./vendor/bin/sail artisan migrate --seed\n"})}),"\n",(0,s.jsxs)(n.p,{children:["You can run the ",(0,s.jsx)(n.code,{children:"reload-db"})," command as much as you want. If you log in using the\ndefault login (",(0,s.jsx)(n.a,{href:"mailto:[email protected]",children:"[email protected]"}),"), this won't log you out, it'll just reload the\ndatabase with all the sample data (from app/Database/seeds/sample.yml)"]}),"\n",(0,s.jsx)(n.h3,{id:"updating",children:"Updating"}),"\n",(0,s.jsx)(n.p,{children:"Extract files and run the migrations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"git pull origin dev\n./vendor/bin/sail artisan migrate\n"})}),"\n",(0,s.jsx)(n.h2,{id:"without-docker",children:"Without Docker"}),"\n",(0,s.jsxs)(n.p,{children:["If you don't want to use Docker, you can use other software like\n",(0,s.jsx)(n.a,{href:"https://herd.laravel.com",children:"Laravel Herd"})," (Mac/Windows) or\n",(0,s.jsx)(n.a,{href:"https://laragon.org/",children:"Laragon"})," (Windows only)."]}),"\n",(0,s.jsx)(n.p,{children:"There are many tutorials on how to install Laravel applications with these\nsoftwares, but here are the basics:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/nabeelio/phpvms.git phpvms\ncd phpvms\n\ncomposer install\nphp artisan phpvms:dev-install\n"})}),"\n",(0,s.jsxs)(n.p,{children:["This does require sqlite. If you want to use MySQL, you need to run the phpvms\ninstaller, so it can generate the config files for MySQL (or you can modify the\ngenerated ",(0,s.jsx)(n.code,{children:".env"}),"), then you can run the above command to reset the database and\nmigrations in MySQL."]}),"\n",(0,s.jsx)(n.h2,{id:"laravel-valet",children:"Laravel Valet"}),"\n",(0,s.jsxs)(n.p,{children:["If you don't want to use ",(0,s.jsx)(n.code,{children:"docker-compose"}),", easiest way to load locally is to\ninstall ",(0,s.jsx)(n.a,{href:"https://laravel.com/docs/5.5/valet",children:"Laravel Valet"})," (if you're running a\nMac). Follow the instructions to install; you install it, go to your phpvms\ndirectory, and run:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"valet link phpvms\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Now going to ",(0,s.jsx)(n.code,{children:"http://phpvms.test"})," should work. If you want to use mysql, follow\nthe valet directions on installing mysql (",(0,s.jsx)(n.code,{children:"brew install mysql"}),") and then update\nthe ",(0,s.jsx)(n.code,{children:".env"})," file to point to the mysql."]}),"\n",(0,s.jsxs)(n.p,{children:["The default username and password are ",(0,s.jsx)(n.code,{children:"[email protected]"})," and ",(0,s.jsx)(n.code,{children:"admin"}),". To see the\navailable users in the development environment,\n",(0,s.jsx)(n.a,{href:"https://github.com/nabeelio/phpvms/blob/master/app/Database/seeds/sample.yml#L11",children:"see this file"})]}),"\n",(0,s.jsxs)(n.p,{children:["There is no reason you can't use ",(0,s.jsx)(n.a,{href:"https://www.mamp.info/en",children:"MAMP"})," or\n",(0,s.jsx)(n.a,{href:"https://www.apachefriends.org",children:"XAMPP"}),", or if you're feeling fancy, using Docker\nor configuring any webservers yourself."]}
1)]})}function c(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},28453(e,n,t){t.d(n,{R:()=>o,x:()=>r});var a=t(96540);const s={},i=a.createContext(s);function o(e){const n=a.useContext(i);return a.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.