• Stars
    star
    104
  • Rank 329,598 (Top 7 %)
  • Language
    HTML
  • Created almost 6 years ago
  • Updated over 4 years ago

Reviews

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

Repository Details

A hackathon boilerplate for Symfony web applications. Start your hackathons or web app without hassle.

banner-symfony

Symfony Hackathon Starter

Live Demo: https://symfony-hackathon-starter.herokuapp.com/

A boilerplate for Symfony web applications.

If you have attended any hackathons in the past, then you know how much time it takes to get a project started: decide on what to build, pick a programming language, pick a web framework, pick a CSS framework. A while later, you might have an initial project up on GitHub and only then can other team members start contributing. Or how about doing something as simple as Sign in with Facebook authentication? You can spend hours on it if you are not familiar with how OAuth 2.0 works.

The aim and usage of this project goes beyond hackathon purposes only, Symfony Hackathon starter will definitely save any developer hours or even days of development time and can serve as a learning guide for web developers in general.

Symfony is an open-source PHP framework with an elegant structure and a reputation for being a suitable framework to kick-start any project irrespective of its size. As a set of reusable components, its flexibility, architecture, and high performance make it a top choice for building a highly complex enterprise application.

Symfony Hackathon Starter is a boilerplate application developed with Symfony 4 to keep you ahead in hackathons.

Modern Theme

LOGIN

REGISTER

Table of Contents

Features

  • Local Authentication using Email and Password
  • OAuth 1.0a Authentication via Twitter
  • OAuth 2.0 Authentication via Facebook, Google, GitHub, GitLab, LinkedIn, Auth0, Instagram
  • Flash notifications
  • MVC Project Structure
  • Bootstrap 4
  • Contact Form (powered by Gmail, Mailgun)
  • Account Management
  • Profile Details
  • Change Password
  • Forgot Password
  • Reset Password
  • Delete Account
  • CSRF protection

Prerequisites

Note: If you are new to Symfony 4, I recommend to watch
Learn Symfony 4, the official screencast for Symfony by Ryan Weaver and the SymfonyCasts crew. Alternatively,
here is another great tutorial for building a project time tracker app for beginners/intermediate developers - Let’s Build a Project Time Tracker with Symfony and VueJS.

Getting Started

Via Cloning The Repository:

The easiest way to get started is to clone the repository:

# Get the project  
git clone https://github.com/yemiwebby/symfony-hackathon-starter.git

Change directory

cd symfony-hackathon-starter  

Copy .env.dist to .env

cp .env.dist .env  

Configure and add database credentials (in .env file)

Open .env file and locate the database URL, then add your database credentials as shown here:

DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
  • Change db_user to YOUR_DATABASE_USERNAME
  • Change db_password to YOUR_DATABASE_PASSWORD
  • db_name to YOUR_DATABASE_NAME
  • The database host by default is 127.0.0.1 and with a database port of 3306. You can leave this values as it is.

Install Composer dependencies

$ composer install

Create Database

$ php bin/console doctrine:database:create

Update Schema

 $ php bin/console doctrine:schema:update --force

Run the application with

php bin/console server:run

home-hac

This starter pack includes the following APIs. You will need to obtain appropriate credentials like Client ID, Client secret, API key, or Username & Password by going through each provider and generate new credentials.

  • GitHub
  • Twitter
  • Auth0
  • LinkedIn

Obtaining API Keys

  • Visit Google Cloud Console
  • Click on the Create Project button
  • Enter Project Name, then click on Create button
  • Then click on APIs & auth in the sidebar and select API tab
  • Click on Google+ API under Social APIs, then click Enable API
  • Next, under APIs & auth in the sidebar click on Credentials tab
  • Click on Create new Client ID button
  • Select Web Application and click on Configure Consent Screen
  • Fill out the required fields then click on Save
  • In the Create Client ID modal dialog:
  • Application Type: Web Application
  • Authorized Javascript origins: http://localhost:8000
  • Authorized redirect URI: http://localhost:8000/secured/login_google
  • Click on Create Client ID button
  • Copy and paste Client ID and Client secret keys into .env

Note: When you ready to deploy to production don't forget to
add your new url to Authorized Javascript origins and Authorized redirect URI,
e.g. http://my-awesome-app.herokuapp.com and
http://my-awesome-app.herokuapp.com/secured/login_google respectively.
The same goes for other providers.


  • Go to Account Settings
  • Select Applications from the sidebar
  • Then inside Developer applications click on Register new application
  • Enter Application Name and Homepage URL
  • For Authorization Callback URL: http://localhost:8000/secured/login_github
  • Click Register application
  • Now copy and paste Client ID and Client Secret keys into .env file

  • Sign in at https://apps.twitter.com/
  • Click Create a new application
  • Enter your application name, website and description
  • For Callback URL: http://127.0.0.1:8000/secured/login_twitter
  • Go to Settings tab
  • Under Application Type select Read and Write access
  • Check the box Allow this application to be used to Sign in with Twitter
  • Click Update this Twitter's applications settings
  • Copy and paste Consumer Key and Consumer Secret keys into .env file

  • Sign in at LinkedIn Developer Network
  • From the account name dropdown menu select API Keys
  • It may ask you to sign in once again
  • Click + Add New Application button
  • Fill out all the required fields
  • OAuth 2.0 Redirect URLs: http://localhost:8000/secured/login_linkedin
  • JavaScript API Domains: http://localhost:3000
  • For Default Application Permissions make sure at least the following is checked:
  • r_basicprofile
  • Finish by clicking Add Application button
  • Copy and paste API Key and Secret Key keys into .env file
  • API Key is your clientID
  • Secret Key is your clientSecret

  • Go to http://www.mailgun.com
  • Sign up and add your Domain Name
  • From the domain overview, copy and paste the default SMTP Login and Password into .env file

Project Structure

Name Description
config/config/fos_user.yaml Configuration for FOS User Bundle
config/config/hwi_oauth.yaml Configuration for HWIOAuthBundle
config/config/security.yaml Configuration for Symfony security's system
config/config/routes/routes.yaml Configuration file for routing
config/config/services.yaml This file is the entry point to configure your own services
controllers/src/Controller/AccountController.php Controller for Account management
controllers/src/Controller/ContactController.php Controller for Contact page
controllers/src/Controller/HomeController.php Controller for rendering all pages
controllers/user.js Controller for user account management.
Entity/src/Entity/User.php User's Entity.
Repository/src/Repository/UserRepository.php User Repository.
Provider/src/Security/MyFOSUBProvider.php Friends of Symfony User bundle provider.
Provider/src/Auth0ResourceOwner.php Provider for Auth0.
public/ Static assets (fonts, css, js, img).
public/css/style.css Main stylesheet for your app.
templates/bundles/FOSUserBundle/ This folder contains templates to override the default templates of FOSUserBundle for login, password reset, signup, profile.
templates/default/index.html.twig/ Templates for the homepage.
templates/emails/contact.html.twig/ Templates file for contact page form.
templates/includes/footer.html.twig/ Footer partial template.
templates/includes/header.html.twig/ Header partial template.
templates/user/account.html.twig/ Templates for the account page.
templates/base.html.twig/ Base template.
templates/contact.html.twig/ Templates for the contact page.
Procfile Configuration file to set the web root on Heroku
.env.dist Your API keys, tokens, passwords and database URI.
composer.json File for loading all php packages.
package.json File for loading all necessary node modules.

List of Packages

Package Description
FOSUserBundle Providers user management for Symfony project
HWIOAuthBundle OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
phpunit PHP testing library
guzzlehttp Simplified HTTP Request library

Useful Tools and Resources

Recommended Design Resources

FAQ

How It Works (mini guides)

This section is intended for giving you a detailed explanation about how a particular functionality works. Maybe you are just curious about how it works, or maybe you are lost and confused while reading the code.

I hope it provides some guidance to you.


How do flash messages work in this project?

Flash messages allow you to display a message at the end of the request and access it on next request and only next request. For instance, on a failed login attempt, you would display an alert with some error message, but as soon as you refresh that page or visit a different page and come back to the login page, that error message will be gone. It is only displayed once.


How do I create a new page?

Go through the following guide in order to successfully create a new page. Check here.

Alternatively, you can also leverage the Symfony maker bundle to generate a controller. Once you do this, it will also automatically create a new templates file that can easily be rendered by the newly generated controller.

To begin, run the following command to have it installed via composer:

$ composer require symfony/maker-bundle --dev

If you are using Symfony hackathon starter project, you don't need to install the maker-bundle again. Next, proceed to your terminal and run:

$ php bin/console make:controller SampleController

The preceding command will create two new file:

  1. src/Controller/SampleController.php - the new controller
  2. templates/sample/index.html.twig - SampleController templates file

To view the new page, ensure that your application is running (php bin/console server:run) and navigate to https://localhost:8000/sample.


Symfony Cheatsheet

Symfony Best Practises

Deployment

Once you are ready to deploy your app, you will need to create an account with a cloud platform to host it. These are not the only choices, but they are my top
picks. From my experience, Heroku is the easiest to get started with, deployments and custom domain support on free accounts.

1-Step Deployment with Heroku

- Download and install [Heroku Toolbelt](https://toolbelt.heroku.com/) - In terminal, run `heroku login` and enter your Heroku credentials - From *your app* directory run `heroku create` - Create a Procfile in your app root. All this file needs to contain is `web: vendor/bin/heroku-php-nginx public` or `web: vendor/bin/heroku-php-apache2 public` if you prefer to use nginx. - Run `heroku addons:add heroku-postgresql:dev ` to add a Postgres database to your heroku app from your terminal - Lastly, do `git push heroku master`. Done!

Note: To install Heroku add-ons your account must be verified.


  • And you are done!

This tutorial will guide you on how to successfully deploy a Symfony 4 Application on Digital Ocean

Contributing

Thank you for considering contributing to Symfony Hackathon Starter. The contribution guide can be found in the Contribution File

Security Vulnerabilities

If you discover a security vulnerability within Symfony Hackathon Starter, please send an e-mail to Olususi Oluyemi at [email protected]. All security vulnerabilities will be promptly addressed.

Credits

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!

Don't forget to follow me on twitter!

Thanks!
Olususi Oluyemi.

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

ci-secure-api

PHP
46
star
2

nest-customer-list-app

Vue
43
star
3

bookstore-nest

TypeScript
27
star
4

gin-gorm-restful-api

Go
26
star
5

symfony-react-app

PHP
21
star
6

laravel-docker

PHP
20
star
7

vue-axios

A simple project that explains how to use axios to fetch data from a public API within Vue Application
Vue
18
star
8

sendSms-laravel

PHP
17
star
9

symfony-docker-tut

PHP
17
star
10

typescript-react-customer-app

TypeScript
14
star
11

time-tracker-app

A demo project time tracker application
PHP
13
star
12

laravel-backend-api-twilio

PHP
12
star
13

yii-library-api

PHP
8
star
14

vue-yii-app

JavaScript
7
star
15

vue-symfony

PHP
7
star
16

repo_order_api

PHP
7
star
17

symfony-react-starter

PHP
6
star
18

golang-company-api

Go
5
star
19

nest-pusher-geofencing

JavaScript
4
star
20

circleci_board

JavaScript
4
star
21

nest-telegram-chat-bot

TypeScript
4
star
22

nest-react-project

TypeScript
4
star
23

frontend-quote-app

Vue
4
star
24

nest-vue-project

Vue
4
star
25

sanity-deno

JavaScript
4
star
26

movie-app-list

HTML
4
star
27

automate-tasks

Automate tasks by creating custom Artisan command in Laravel Application
PHP
4
star
28

laravel-eloquent-macros

A demo project showing how to use laravel eloquent macros
PHP
3
star
29

vue-pwa

Getting started with PWA VueJs
JavaScript
3
star
30

vue-chat-app

Vue
3
star
31

backend-quote-app

Backend for a Quote Application.
PHP
3
star
32

lara-bookstore

PHP
3
star
33

nest-vue-blog-backend

TypeScript
3
star
34

laravel-chat-app

Vue
3
star
35

twilio_bulk_sms_app

PHP
3
star
36

rust-planetscale

Rust
3
star
37

most-common-laravel-errors

A List Of the Most Common Errors / Exceptions When Developing Laravel Applications and Solutions.
3
star
38

node-vue-chat-room

Vue
2
star
39

go-user-rest-api

Go
2
star
40

parcel-project-intro

Getting Started with Parcel: Zero Configuration Module Bundler
JavaScript
2
star
41

go-bulk-sms

HTML
2
star
42

participants-registry

Go
2
star
43

product-listing-app

A product listing application built with Symfony and React
PHP
2
star
44

reason-bucklescript-todo

OCaml
2
star
45

ably-nest-poll

HTML
2
star
46

change-detection-angular

TypeScript
2
star
47

gin-gorm-api-testing

Go
2
star
48

generate-pdf

PHP
1
star
49

angular-ci-firebase

TypeScript
1
star
50

docker-django-test

JavaScript
1
star
51

spring-exchange

Java
1
star
52

laravel-phpunit-starter

PHP
1
star
53

nest-project

TypeScript
1
star
54

nest-graphql-mongodb

A Nest + TypeScript + GraphQL + MongoDB starter project.
TypeScript
1
star
55

pusher-rails-chart

Ruby
1
star
56

symfony-covid19-tracker-bot

PHP
1
star
57

nest-geofencing

JavaScript
1
star
58

kendo-gallery-app

TypeScript
1
star
59

symfony-react-mobx-app

JavaScript
1
star
60

Vue-scotch-quote-app

Frontend view for the quote application built with laravel
Vue
1
star
61

Angular-2-Data-binding

The basics of data binding with angular 2.
JavaScript
1
star
62

NodeJS-Basics

The important basics to get started with NodeJs
JavaScript
1
star
63

chat-app-ember

JavaScript
1
star
64

realtime-chat-nest

TypeScript
1
star
65

stencil-pwa-scotch

TypeScript
1
star
66

muuri-grid

HTML
1
star
67

symfony-blog

PHP
1
star
68

quiz_app

TypeScript
1
star
69

ci-heroku-loop

TypeScript
1
star
70

Users-profile-on-github

Search for any user's profile on github
JavaScript
1
star
71

recipe-box

A tutorial to demonstrate using vue.js with laravel 5.4
PHP
1
star
72

hack-bg-api

JavaScript
1
star
73

cometchat-angular-ui-kit

TypeScript
1
star
74

nest-slack-twilio

TypeScript
1
star
75

twilio-laravel-app-survey

PHP
1
star
76

realtime-poll-pusher

JavaScript
1
star
77

unread-messages

Vue
1
star
78

exchange-api-tutorial

Java
1
star
79

chat-bot-ember

JavaScript
1
star
80

laravel-api-testing-starter

PHP
1
star
81

nest-comment

TypeScript
1
star
82

symfony-api-server

PHP
1
star
83

nest-testing-2

TypeScript
1
star
84

grid-css-layout

A responsive simple template built with css grid
HTML
1
star
85

nest-pusher-poll

TypeScript
1
star
86

laravel-image-upload

Upload Image to Cloudinary Using Laravel
PHP
1
star
87

lumen-api-auth0

PHP
1
star
88

yii-library-codeception

PHP
1
star
89

Lara_Social

A simple social media website built with Laravel 5.3 and Vue.js 2
CSS
1
star
90

react-mobx

JavaScript
1
star
91

Laravel-quote-backend

A quote application built with laravel. This will function as the backend for posting, fetching and updating quotes. With this in place, any javaScript frontend framework can then be used to communicate with laravel and render the view.
PHP
1
star
92

symfony-react-mobx-starter

PHP
1
star
93

dotnet-heroku-demo-app

HTML
1
star
94

dotnet-heroku-starter

HTML
1
star
95

hack-bg-gallery-app

A gallery application built with Angular and cloudinary
1
star
96

voice_otp_generator

PHP
1
star
97

Angular-scotch-quote-app

Frontend view for the quote application built with laravel
1
star
98

realtime-trade

Pusher Realtime Stock Tick Demo
JavaScript
1
star
99

thumbnail-microservice

JavaScript
1
star
100

nest-heroku-demo

TypeScript
1
star