Giter Site home page Giter Site logo

4arda / symfony-3-made-simple Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mostaphazeghaouigmail/symfony-3-made-simple

0.0 0.0 0.0 4.15 MB

Symfony 3 starter kit with Users management, Images management (Drag & drop + multiupload), Pages management, Articles management, Comments and Settings Management - symfony3 (FosUserBundle - EasyAdminBundle - LiipImagineBundle - FosJsRoutingBundle)

PHP 15.16% HTML 6.95% CSS 5.08% JavaScript 72.81%

symfony-3-made-simple's Introduction

Symfony 3 Made Simple starter kit

###Documentation under construction###

Hi! This is my Symfony 3 starter kit. It's certainly not perfect, so feel free to use and improve upon it. It comes with a bunch of nice bundles and a couple of basic blocks: image management with drag and drop and multi upload, simple comment management, simple widgets (ahem... very simple, don't get your hopes too high). It's really not a cms, you're not supposed to take it like it is. It has been created to be modified for your unique use-cases. With this starter, you can manage: Users, Pages, Articles, Images, Comments, Settings.

I'm writting a full documentation here, the website is made with this starter

Inside

  • Symfony\Bundle\FrameworkBundle\FrameworkBundle
  • Symfony\Bundle\SecurityBundle\SecurityBundle
  • Symfony\Bundle\TwigBundle\TwigBundle
  • Symfony\Bundle\MonologBundle\MonologBundle
  • Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle
  • Symfony\Bundle\AsseticBundle\AsseticBundle
  • Doctrine\Bundle\DoctrineBundle\DoctrineBundle
  • Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle
  • FOS\UserBundle\FOSUserBundle
  • FOS\JsRoutingBundle\FOSJsRoutingBundle
  • JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle
  • Vich\UploaderBundle\VichUploaderBundle
  • Liip\ImagineBundle\LiipImagineBundle
  • Ivory\CKEditorBundle\IvoryCKEditorBundle

Image Management

MultiUpload, Drag and drop, sortable, resize

Juste use Imageable Trait in your entity

use AppBundle\Traits\Imageable;

class Page
{
    use Imageable;

}

That's it! After that you can retreive your image with entity.getImages()

To show them on your view : asset("uploads/image/"~image.image)|imagine_filter('thumbnail')

Filters are defined in app/config/liip_imagine.yml

All image are online editable editable with the famous DarkroomJs

Map

Just a tiny widget, type app_twig.getMap(your_lat,your_lng)|raw on your view

You can change it easily on app/Resources/views/component/map

Comment

Juste use Imageable Trait in your entity

use AppBundle\Traits\Commentable;

class Page { use Commentable;

}

That's it! After that you can retreive your comment with entity.getComments()

To get the form : app_twig.getCommentForm(entity)|raw

To get a predefined list, type app_twig.getCommentList(entity)|raw , template are located in app/Resources/views/comment

You can allow and disallow anonymous comments by changing parameter allow_anonymous_comments to 0 or nop or non or no or x

You can set the comments to be published by default or not by changing the following parameter: validated_comments_by_defaut to 0 or nop or non or no or x

Tracking

Another tiny widget, type app_twig.getAnalitycsTracking('your tracking code')|raw on your view

If you set the parameter named tracking_code just do app_twig.getAnalitycsTracking()|raw

It will output the default analitycs code tracking

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'your_code' ]);
    _gaq.push(['_trackPageview']);

    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

Feel free to customize it, it's located in views/component/analitycs/

Slider

Just a tiny widget again (i know, i know...), Just type app_twig.getSlider(entity)|raw on your view

It's the bootstrap slider. For now, it's made for imgeable entities, feel free to make your own :)

It's located in views/component/slider/

Contact Form

Type app_twig.getContactForm(), you can customize fields on src/Type/ContactType.php, the view is located on app/Resources/views/emails/contact

You may need to set your configuration on parameters.yml

Settings

Some settings are locked, but you can remove them by editing the file AppBundl/Listener/LifeCycleSliner.php

List of default settings :

  • Default Slug route
  • Analitycs tracking
  • By default, comments published without moderation
  • Allow anonymous comment
  • Contact Email
  • Website description
  • Website name

Route

/{slug} -> page

/blog -> articles index

/blog/{slug} -> article page

/image/{slug} -> image page

Page and Article

- Page and Article are by default commentable

- The template property create a template file located in app/Resources/views/article or page

- The property style add the style on the head of the page

Menu

Simple Menu Management (one level for now)

Position are changeable by drag and drop

if a menu item is related to a page or an article and he's parent title is modifed, the item uri is modified to

To get the main menu on view, type app_twig.getMenu()|raw

Twig Helper

There is a twig helper named app_twig, the class is located at src/AppBundle/Service/AppService.php

It's also a service, you can use it on every controlleur

Image

Retrieve Image on view for image property (Vich) : app_service.getImage(entity)

Get e bootstrap slider for imageable entities : app_service.getSlider(entity)|raw

Comment

Get the comment Form for commentable entities : app_service.getCommentForm(entity)|raw

Get the comment List for commentable entities : app_service.getcommentList(entity)|raw

MAP

Get the map widget : app_service.getMap(id_map,lat,lng,content)

Analitycs

Get analitycs tracking script code : app_service.getAnalitycsTracking(code)|raw

Setting

Retreive a setting's value : app_service.getSetting(key,type = false)

Menu

Get the main menu on view : app_twig.getMenu()|raw

API

There is a tiny little API

If you want your entity api capable, just use ApiCapable trait in it

You can customize the public / private on security.yml for method, by default, PUT and POST method require an admin role

It's just made for building for exemple a front with angular or somthing like that, you can set the api_key in parameters.yml

You need to add api_key in get parameter

Method and route

GET /api/{model} -> Retreive all entity of a model

GET /api/{model}/{id} -> Retreive entity of a model with id

PUT /api/{model} -> update entity of a model

POST /api/{model} -> create entity of a model

Theme

It comes to my attention that it would be preferable to make a theme management, so i dit it

All theme need to be place in app/Ressources/views/themes

You can create theme from the back-office, if you don't put the directory corresponding to the folder name you gave, the system will propose you to create the whole theme structure

If you create the theme structure by the backoffice, no need to di anything, but if not, you need to create a symlink to web path like the defaut theme

You can do that by clicking on the link assets button on themes list

Tag system

Done but not the doc for now

Installation

git clone https://github.com/sohrabg/made-simple.git

composer install

Create an empty database

php bin/console app:init

php bin/console assets:install --symlink

Answer all question

Start to work

INFORMATIONS

I a m working on this currently, so you may have to make php bin/console doctrine:schema:update --force if you pull the project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.