I want to start developping an online portal with Symfony 2 for a specific business case. User can register, save some data and schedule some executions.
But before I will start to invent all features by myself I tought I would ask the community if there is a starter-package Symfony 2 with some core functionalities (MVC) for an simple online portal:
Registration
Login (BN/PW, FB-Login, ...)
Login reset
User management for admins
Maybe with some optional functionalities for users like:
Profil edit
Avatar upload
PW change
If there is a starter-package I could save a lot of time and start developing my business logic faster.
Thanks,
rjgamer
There is no 'out-of-box' complete Symfony2 application which run immediatly after installation.
BUT
Symfony2 has a concept for this way. The concept call 'Bundle'.
Bundle is used for speedly building application with Symfony2 Framework.
With lot of bundle in application symfony2, you can easily and more faster construct an application. More configuration and parameters but less implementation of code.
The most popular example of this concept and your requirements is the bundle FOSUserBundle which help you to install a full system of user for your application without implementing yourself lot of basics concepts of management users.
You must search bundle for which of your requirements.
You find for almost anytime a bundle for your requirements.
Perhaps search a github project which contain all of this popular bundle in symfony application.
Welcome to big world of Symfony and try to find your favorite bundle !
Related
Symfony framework has a "remarkable" implementation of user authorization and management using a 3rd party bundle - FOS User Bundle.
However, Symfony 3 also have the security component (https://symfony.com/doc/current/components/security.html) that have enough of functionality to implement a complete system without FOS.
What plan would you follow to implement a complete user authorization and management system without FOS or other 3rd party bundles? Required functionality: registration, sign in, user roles, privileges.
Would you even go this route or using FOS is the better way? Why does Symfony not have a solid out of box solution for user management?
I would say Symfony doesn't have a standard implementation because FosUser was already out and good enough when they would have started to make their own.
As far as using Fos or not, this is a perfect example of "Reinventing the wheel" as FosUser is the most used Symfony bundle and nobody complains about it(except for the fact that they still didn't release a stable 2.0 for Symfony 3).
If you still want to make you own implementation the best source you can find to bootstrap your project would obviously be FOSUser.
If you want to have a look at another UserBundle unrelated to fos you can check out: https://github.com/Sylius/Sylius/tree/master/src/Sylius/Bundle/UserBundle
I am looking for a skeleton application for the YiiFramework to get me up-and-running with a simple PHP application I would like to build. Some requirements are:
A login/authentication system that keeps the current user's session state (and is secure from injection attacks, etc).
It connects to a back-end database (MySql).
Has an example table display that demonstrates CRUD operations. i.e. List records from a specific table, a form to edit a specific record as well as pagination and basic search filter.
A menu framework that can be easily added to.
(Ideally) A pre-existing, visually appealing theme.
(Ideally) Has a structure that supports language localisation.
(Ideally) Has a framework for a REST API.
I have seen https://github.com/clevertech/yiibooster which provides a nice set of components that would take care of these requirements, however from what I understand, all the above would still need to be assembled. I know that the YiiFramework is designed to make quick work of this, however I have never used any of these frameworks before and would learn much quicker from a pre-existing example/template (and/or existing Yii application) rather than going through the documentation.
Any help appreciated.
As mentioned by #Bizley, Yii2 Advanced Project Template is a very good starting point to learn the concepts & get hands on with Yii2.
There are several other Yii2 templates available & most of them have been developed by customizing and/or adding features to the Yii2 Advanced Template. Just for your reference here are some Yii2 templates (in no particular order) -
yii2-improved-advanced-template
http://www.yiiframework.com/extension/yii2-improved-advanced-template/
Introduction
Yii2-advanced-template is based on yii2-app-advanced created by yii2
core developers. There are several upgrades made to this template.
This template has additional features listed in the next section.
Application structure has been changed to be 'shared hosting
friendly'.
Features
Signup with/without account activation
Login using email/password or username/password combo.
Rbac tables are installed with other migrations when you run yii migrate command.
Users with editor+ roles can create articles.
Session data is stored in database out of the box.
System setting are stored in config/params.php file ( changes from v2 ).
Theming is supported out of box.
Translation is supported out of the box.
Administrators and The Creator can manage users ( changes from v2 ).
Password strength validation and strength meter.
All functionalities of default advanced template are included in this template.
Code is heavily commented out.
Yii2 Practical App
http://demos.krajee.com/app-practical
Why yii2-app-practical?
After installing a app in the yii2-advanced application you normally
would access the frontend from http://domain/app/frontend/web.
However, in many practical scenarios (especially on single domain
hosts) one would want their users to directly access frontend
as:http://domain/app
The yii2-app-practical enables you to achieve just that by carefully
moving and rearranging the bootstrap files and web components of
frontend to work directly out of the app root. The frontend/web is
entirely eliminated and one can directly access the application
frontend from http://domain/app
All other aspects of the app configuration remain the same as the
yii2-advanced app. The common, backend and console will remain as is.
The frontend config, assets, models, controllers, views, widgets and
components, will still reside within the frontend directory. It is
just the web access that is moved out to app root.
Yii 2 Starter Kit
https://github.com/trntv/yii2-starter-kit
This is Yii2 start application template.
It was created and developing as a fast start for building an advanced
sites based on Yii2.
It covers typical use cases for a new project and will help you not to
waste your time doing the same work in every project
FEATURES
Beautiful and open source dashboard theme for backend AdminLTE 2
Translations: English, Spanish, Russian, Ukrainian, Chinese
Translations Editor
Language change action + behavior to choose locale based on browser preferred language
Sign in, Sign up, profile(avatar, locale, personal data), email activation etc
OAuth authorization
User management
RBAC with predefined guest, user, manager and administrator roles
RBAC migrations support
Content management components: articles, categories, static pages, editable menu, editable carousels, text blocks
Key-value storage component
Application settings form (based on KeyStorage component)
Ready-to-go RESTful API module
File storage component + file upload widget
On-demand thumbnail creation trntv/yii2-glide
Command Bus with queued and async tasks support trntv/yii2-command-bus
Useful behaviors (GlobalAccessBehavior, CacheInvalidateBehavior, MaintenanceBehavior)
Yii2 log web interface
Application timeline component
Cache web controller
Maintenance mode component (more)
System information web interface
dotenv support
ExtendedMessageController with ability to replace source code language and migrate messages between message sources
Aceeditor widget
Datetimepicker widget,
Imperavi Reactor Widget,
Elfinder Extension
Xhprof Debug panel
Extended IDE autocompletion
Nginx config example
Test-ready
Docker support and Vagrant support
Built-in mailcatcher
Assets compression and concatenation
Some useful shortcuts
many other features i'm lazy to write about :-)
I guess these should be more than enough to get you started.
Should I create new bundle and use sepparate assets for admin page, or could I just create new adminAction() as page? What would be safer and more correct?
I am not familiar to Symfony2 web structure and want to get better at it. Thanks in advance :)
I have only done a bit of Symfony 2 but the vast majority of project I have seen are using separate bundle for the Admin backend, such as the sonata project
It provides a better separation of concerns, as backend actions are oftenly related to CRUD, when frontend are usually more displays and users managements stuffs (depending on the goal of your project though).
To go further you can also already find bundle similar to the admin backend generator module of symfony (v1), like the symfony2admingenerator
Hope it helped a little.
It depends on your application and there is no "Only one good way". Try to comply SOLID principles and all will be great.
Making many bundles - very bad idea (if you will not reuse your admin-bundle in other projects). You can find info about that in official symfony best-practices
I have an old project which I want to add user management to.
Symfony has the FOSUserBundle which makes user straightforward.
Is there a way to integrate Symfony in the old project so that I can benefit from the UserBundle?
This question is extremely hard to answer without specific details of the existing project. We have no idea how the project was constructed. Is it all spaghetti code? Is it MVC based? Is it using an existing framework?
If you're asking if somehow Symfony2 and FOSUserBundle can somehow be shoehorned into your project - I doubt it. A number of Symfony2's features can be used as stand alone libraries, but bundles, and therefore FOSUserBundle, are tightly coupled with Symfony2's MVC stack.
You need to ask yourself if you're willing to rewrite your project using Symfony2. If you're not, then you need to find another solution for user management that will work with what you've already got setup.
I'm just working through the Symfony2 Bible and I'm a little stuck on the bundle system. It is a great feature but I'm not quite sure how to split my flat PHP application into bundles. It's my first time splitting my PHP code into a full featured MVC framework.
I'm working on a few online games (based on PHP) but how would I define the bundles ? Is it like one single onlinegame1 bundle with all the controllers and functions - Or like a login bundle, a register bundle, a war bundle - summarized one bundle for every single PHP file I got ?
I want to start clean and correct but I'm not quite sure if I understand that feature.
You could think of bundle as an independent reusable component - in most of the cases at least.
Let's imagine a personal blog website. I'd split it into ArticleBundle, UserBundle, CommentBundle and finally MainBundle which would stick all these other bundles together, creating your website. The main point is that you can take for example ArticleBundle and reuse it easily on other project without it being tied to any other bundle.
From Symfony2 book:
A bundle is similar to a plugin in other software, but even better.
The key difference is that everything is a bundle in Symfony2,
including both the core framework functionality and the code written
for your application. Bundles are first-class citizens in Symfony2.
This gives you the flexibility to use pre-built features packaged in
third-party bundles or to distribute your own bundles. It makes it
easy to pick and choose which features to enable in your application
and to optimize them the way you want.