Skip to content

Commit

Permalink
feat: all application
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainJojo committed Sep 10, 2017
1 parent 969f3af commit 555fd68
Show file tree
Hide file tree
Showing 71 changed files with 10,403 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "react"]
}
16 changes: 16 additions & 0 deletions .env
@@ -0,0 +1,16 @@
# PATH DIR
SYMFONY_APP_PATH=./
LOGS_DIR=./docker/logs

# DATABASE
POSTGRES_HOST=postgres
POSTGRES_DB=infinite
POSTGRES_USER=infinite
POSTGRES_PASSWORD=infinitepass
POSTGRES_PORT=5432

# PORT WEB
WEB_PORT=80

# SYMFONY
SECRET=d3e2fa9715287ba25b2d0fd41685ac031970f555
10 changes: 10 additions & 0 deletions .eslintrc.yml
@@ -0,0 +1,10 @@
---
extends: "airbnb"
env:
node: true
browser: true
jest: true
settings:
import/resolver:
webpack:
config: 'app/config/webpack.config.js'
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v6.9.0
7 changes: 7 additions & 0 deletions app/.htaccess
@@ -0,0 +1,7 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
7 changes: 7 additions & 0 deletions app/AppCache.php
@@ -0,0 +1,7 @@
<?php

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;

class AppCache extends HttpCache
{
}
55 changes: 55 additions & 0 deletions app/AppKernel.php
@@ -0,0 +1,55 @@
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();

if ('dev' === $this->getEnvironment()) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}

return $bundles;
}

public function getRootDir()
{
return __DIR__;
}

public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}

public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
13 changes: 13 additions & 0 deletions app/Resources/views/base.html.twig
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
30 changes: 30 additions & 0 deletions app/Resources/views/default/index.html.twig
@@ -0,0 +1,30 @@
{% extends 'base.html.twig' %}

{% block body %}
<div id="react-latest-news-home" >
<ul>
{% for article in latestNews %}
<li>
{{ article.title }}
</li>
{% endfor %}
<ul>
<div>
{% endblock %}

{% block javascripts %}
{% set initial_state = {
latestNews: {
data: latestNews,
lastItemDate: lastItemDate,
limit: 3,
},
} %}
<script>window.__INITIAL_STATE__ = {{ initial_state|json_encode|raw }};</script>
<script src="{{ asset('inlined.js', 'js') }}" defer></script>
<script src="{{ asset('vendor.js', 'js') }}" defer></script>
<script src="{{ asset('home.js', 'js') }}" defer></script>
{% endblock %}

{% block stylesheets %}
{% endblock %}
59 changes: 59 additions & 0 deletions app/config/config.yml
@@ -0,0 +1,59 @@
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en

framework:
#esi: ~
#translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
router:
resource: '%kernel.project_dir%/app/config/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
trusted_hosts: ~
session:
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
fragments: ~
http_method_override: true
assets: ~
php_errors:
log: true
assets:
packages:
js:
base_urls: 'http://infinite.dev/scripts/js'
version_strategy: 'app.assets.js.version_strategy'

# Twig Configuration
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

# Doctrine Configuration
doctrine:
dbal:
driver: pdo_pgsql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
41 changes: 41 additions & 0 deletions app/config/config_dev.yml
@@ -0,0 +1,41 @@
imports:
- { resource: config.yml }

framework:
router:
resource: '%kernel.project_dir%/app/config/routing_dev.yml'
strict_requirements: true
profiler: { only_exceptions: false }

web_profiler:
toolbar: true
intercept_redirects: false

monolog:
handlers:
main:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
channels: ['!event']
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
# To follow logs in real time, execute the following command:
# `bin/console server:log -vv`
server_log:
type: server_log
process_psr_3_messages: false
host: 127.0.0.1:9911
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info

#swiftmailer:
# delivery_addresses: ['me@example.com']
22 changes: 22 additions & 0 deletions app/config/config_prod.yml
@@ -0,0 +1,22 @@
imports:
- { resource: config.yml }

#doctrine:
# orm:
# metadata_cache_driver: apc
# result_cache_driver: apc
# query_cache_driver: apc

monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
console:
type: console
process_psr_3_messages: false
16 changes: 16 additions & 0 deletions app/config/config_test.yml
@@ -0,0 +1,16 @@
imports:
- { resource: config_dev.yml }

framework:
test: ~
session:
storage_id: session.storage.mock_file
profiler:
collect: false

web_profiler:
toolbar: false
intercept_redirects: false

swiftmailer:
disable_delivery: true
8 changes: 8 additions & 0 deletions app/config/parameters.yml
@@ -0,0 +1,8 @@
# This file is auto-generated during the composer install
parameters:
database_host: '%env(POSTGRES_HOST)%'
database_port: '%env(POSTGRES_PORT)%'
database_name: '%env(POSTGRES_DB)%'
database_user: '%env(POSTGRES_USER)%'
database_password: '%env(POSTGRES_PASSWORD)%'
secret: '%env(SECRET)%'
6 changes: 6 additions & 0 deletions app/config/parameters.yml.dist
@@ -0,0 +1,6 @@
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
3 changes: 3 additions & 0 deletions app/config/routing.yml
@@ -0,0 +1,3 @@
app:
resource: '@AppBundle/Controller/'
type: annotation
14 changes: 14 additions & 0 deletions app/config/routing_dev.yml
@@ -0,0 +1,14 @@
_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt

_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

_main:
resource: routing.yml
24 changes: 24 additions & 0 deletions app/config/security.yml
@@ -0,0 +1,24 @@
# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:

# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
in_memory:
memory: ~

firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

main:
anonymous: ~
# activate different ways to authenticate

# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~

# https://symfony.com/doc/current/security/form_login_setup.html
#form_login: ~
39 changes: 39 additions & 0 deletions app/config/services.yml
@@ -0,0 +1,39 @@
# Learn more about services, parameters and containers at
# https://symfony.com/doc/current/service_container.html
parameters:
#parameter_name: value

services:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false

# makes classes in src/AppBundle available to be used as services
# this creates a service per class whose id is the fully-qualified class name
AppBundle\:
resource: '../../src/AppBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']

# add more services, or override services that need manual wiring
# AppBundle\Service\ExampleService:
# arguments:
# $someArgument: 'some_value'
app.assets.js.version_strategy:
class: AppBundle\Service\VersionStrategy\JavascriptBusterVersionStrategy
arguments:
- '%kernel.root_dir%/../var/webpack/manifest.json'

0 comments on commit 555fd68

Please sign in to comment.