https://github.com/programarivm/doctrine-without-symfony
This is Doctrine without Symfony, or a standalone Doctrine app if you like -- another blog in the form of a few PHP CLI examples with Docker.
https://github.com/programarivm/doctrine-without-symfony
Last synced: 11 months ago
JSON representation
This is Doctrine without Symfony, or a standalone Doctrine app if you like -- another blog in the form of a few PHP CLI examples with Docker.
- Host: GitHub
- URL: https://github.com/programarivm/doctrine-without-symfony
- Owner: programarivm
- Created: 2018-06-18T15:15:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-19T20:03:56.000Z (over 7 years ago)
- Last Synced: 2025-01-08T14:16:08.298Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Doctrine without Symfony
This is Doctrine without Symfony, or a standalone Doctrine app if you like -- another blog in the form of a few PHP CLI examples with Docker.
### Create the `.env` File
First things first, create the following `.env` file in the app's root folder.
DB_DRIVER=pdo_mysql
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=another_blog
DB_USERNAME=root
DB_PASSWORD=password
### Install Dependencies
Via composer:
$ composer install
### Start the Docker Services
docker-compose up --build
### Run the PHP CLI Examples
SSH the blog container:
sudo docker exec -it /bin/bash
Create the database schema:
php vendor/bin/doctrine orm:schema-tool:create
Run the examples:
php examples/01-create-users.php
php examples/02-write-post.php
php examples/03-comment-post.php