Clone the app
git clone https://github.com/smerth/symfony-blog-and-job-board-demo-app.git
Set up empty database
Install dependancies
composer install
create the schema in your empty database
app/console doctrine:schema:create
install assets
app/console assets:install
clear cache
app/console cache:clear
run the app
app/console server:run
Now you have an fully working app. But there is no data...
Create dummy users, blog posts and job listings
app/console doctrine:fixtures:load
Test the login using the admin credentials and
Users are created from data loaded from
@ /app/Application/Sonata/UserBundle/DataFixtures/ORM/LoadUserData.yml
# src/Application/Sonata/UserBundle/DataFixtures/ORM/LoadUserData.yml
useradmin:
username: admin
firstname: David
lastname: Jacquel
date_of_birth: 1980-10-20
gender: m
phone: +99999999999
email: admin@example.com
plainPassword: admin
isAdmin: true
useralice:
username: alice
firstname: Alice
lastname: Bonnon
date_of_birth: 1968-12-27
gender: f
phone: +33675982044
email: alice@example.com
plainPassword: alice
userbob:
username: bob
firstname: Bob
lastname: Leponge
date_of_birth: 1976-10-24
gender: m
phone: +33898982044
email: bob@example.com
plainPassword: bob
Users with admin status can enter and publish blog posts. Admin users can also log in and manage the site content: blog posts, comments, job listings and users.
Regular users can login and comment on blog posts.
Anonymous users should be able to post a job listing (currently broken.)
This project started out as a study site for Symfony based on the Symfony Demo installation. Then a job-board was added based on the Jobeet tutorial.
Each App has its own folder:
-
Symfony Demo ->
src/AppBundle
-
Jobeet Tutorial ->
src/Sm/JobsBundle
So you can uninstall either or both. You can add your own app, or use this project to see how I put things together (which may or may not be the best way...)
app/Application/Sonata/UserBundle
is where you will find the admin backend installed since an admin backend is shared with any other app you install in the project.
app/Resources
is where all the templating and front end work is done. The Jobeet tutorial has its own folder JobsBundle
but the Symfony Demo (the Blog app) relies on templates in app/Resources/views
Resources
could be better organized so each app has its own folder (like JobsBundle.) That would make is easier to add and delete apps as needed.
Some of the projects I have integrated into this Symfony demo are:
- FOS User Bundle
- FOS Rest Bundle
- Sonata Admin Bundle
- Slugify
- Faker
- Alice
- KPN Menu
- Assetic
- Scssphp
- Php markdown
- Swiftmailer
The demo data is generated by each app's appFixture.php file. Jobs and blog posts use fakr data but users data employs an AppFixture that formats according to the needs of FOS User bundler User class.
So, with a little magic from Doctrine you can get it up and running in a flash.
This is a learning project for Symfony and I find the documentation on Symfony a bit thin, so no guarantees about what is best practice.