Authorization library on Symfony HttpFoundation Component - php

Can anyone knows a library to authenticate users using Symfony HttpFondation Component?
PS Symfony Security Component is not suitable, as too big.
PPS Project does not using Symfony Framework.

I don't think there is any (at this time).
PPI framework uses some of the Symfony components (also HttpFoundation). See how they solved it. Otherwise you'd probably need to handle it yourself.

Related

Existing Zend 1.10 framework project incorporating Symfony 2 framework

I've got an existing project using zend 1.10 framework. I'm not fond of zend but I can't sell the idea of converting over to symfony, I'd like to just incorporate symfony 2 into the code base and at least use it for new code (doctrine, forms and twig templates at least, even if I'm stuck with zends' MVC structure).
Not sure how to go about setting this up. I see lots of mention of using Zend classes in Symfony but not the other way around.
You can use Twig and Doctrine with ZF, so that's no problem. However the forms component is not on the list of stand alone components for Symfony 2 so implementing Symfony 2 forms in ZF 1.10 might be tricky.
Good Luck.

The difference between Symfony and Silex

I would like to try Silex but i've some questions.
I know to use Symfony2 and i would like to know if Silex is very different of Symfony or it's the same thing (same operation, same code... ) ?
Moreover, Silex is recommanded for small PHP projects and Symfony for medium or big projects , it's true ?
A few things worth noting:
Silex is based on the Symfony2 components, just like the Symfony2 framework is. As such, it can be considered an alternative user interface to the components (the user being a web developer).
Since they use the same basis, migration between them should be relatively easy.
Just like Symfony2, Silex is mostly a controller framework. It provides you with some structure, but the model and view parts are handled by third-party libraries (such as Twig or Doctrine).
Since your business logic should not be in your controllers anyway, if you separate that code out and keep your controllers light, the limiting factor in terms of project size will only be the amount of routes you have.
That said, Silex will not give you the bundles that Symfony2 has.
Here are some interesting thoughts on when to use Silex (especially in the comments):
https://web.archive.org/web/20160131151109/http://www.testically.org/2011/10/11/is-there-a-specific-situation-when-to-use-a-php-micro-framework-like-silex/
Silex itself is pretty bare, which means that if you want more then just routing and tests you will need to add specific features (DB, Twig ...) in form of Services.
I recommend to take a look at some readymade Plates that provide you with this:
https://github.com/lyrixx/Silex-Kitchen-Edition
or
https://github.com/ivoba/superleansilexplate (thats mine :))
Another point is that Silex has a probably lighter footprint than Symfony2, so if you need a smaller & faster site, Silex is worth a consideration.
(UPDATE) Since Symfony 2.8 You can use symfony 2 as a microframework with a micro kernel controller. See short description here: symfony.com/blog/new-in-symfony-2-8-symfony-as-a-microframework. Now Symfony gives us more control over the structure and architecture. Good alternative to Silex if You prefer the Symfony 2 style.
Comparing Silex to Symfony before 2.8 release
Silex microframework is based on Symfony but it's not exactly the same thing. Using a full-stack framework such as Symfony for a small project is simply overkilling the project.
In a microframework, you have more flexibility to choose the tools you want to use. You can make more decisions about application architecture and logic.
In a full-stack framework with some extend you would have an architecture and a logic already predefined with restrictions and limitations to its configuration.
Silex was designed to build up the tool rather than get the set tools that you might not need. I would say that for small projects in Symfony you would have to remove features - were in Silex you would have to add them.
It is also not true that Silex isn't fit for larger projects. Silex can be used with success for larger projects but remember that you would have to build up your tools to fit your requirements (if you need to customize the architecture and logic - perhaps this is the right way to go). Other than that, I would consider using Symfony instead, because Symfony already has bunch of tools available out of the box.
Bear in mind that:
To conclude, Silex is good for smaller applications and for those, it can surely replace Symfony. Silex can also be used for larger projects (but for larger applications I would recommend to use full-stack framework instead, like Symfony).
Reference for slides at: http://www.slideshare.net/dustin.whittle/silex-from-micro-to-full-stack . If you feel like it, go ahead and read some more about the Silex framework.
I also recommend watching this intro comparing Silex to Symfony: https://www.youtube.com/watch?v=RDVtnsoOysE.
Again, a few Pro for using Silex coming from people who actually use it: https://www.youtube.com/watch?v=OJcdHGJFfLU
Silex is good for small projects, but it can be used for big projects as well. What I like the most of Silex is that I have complete control over my project structure but it's my responsibility if my project is well organized or not.
Also I recommend it over symfony if like me, you moved your application logic to the client side using a JS framework. For me it feels an overkill to use symfony only to serve a few json requests.
Silex is based on the independent Symfony2 components and isn't truly considered a full-stack web application framework like Symfony is. You should only use it for very small projects that only require a few files, or you'll outgrow it pretty quickly.
Silex is a great framework for small as well as big applications. Giving structure to the project is your responsibility in Silex. As the project becomes larger, you can nicely integrate symfony components into it although the documentation for the symfony provider is not so good especially for symfony security component.
Silex is great for prototyping projects. If you know you will be using most of the symfony components then go for symfony because you will end up with integrating almost all symfony components into silex.
In my case I needed speed right out of the box and silex provided me with the speed and although I am using most of the symfony components, it is a lot faster than symfony out of the box.
At the moment I write this, Silex is in maintenance mode and it's end of life occured in June 2018.
Which means you shouldn't use it anymore for new projects.
They recommend you to use Symfony 4 instead.
Silex was really good and fast (maybe faster than symfony 4 for simple requests/requirements), but SF4 may bring some new stack and benefits to our applications.
Update: However, in all of my attempts on migrating from Silex to Symfony 4, the simple services took 4x times more to respond no matter what I do. Silex seems to do a much better job for simple micro services.
Silex is a PHP microframework. It is use for the small project.The coding style of the symfony and the silex is almost similar to the symfony.But the symfony is use for the large projects

Symfony 2.0 and REST

What are the best practices for using REST with Symfony 2.0. I've found various questions on SO that discuss Symfony 1.4 (and lower), but nothing for 2.0.
I would look into the FOSREstBundle. It is full of best practices for combining Symfony2 and REST. It also makes the process of developing a REST API in Symfony quite painless.

What authentication libraries for PHP are not attached to a framework and meet these requirements?

Whenever I Google things like "php authentication library" I continue to come up with a ton of results of authentication libraries designed for Code Igniter.
What I am looking for is things like the following,
A robust library that handles login, logout, registration, login retrieval etc...
Very secure authentication possibly using sha-256+?
Library that can be integrated into any code, framework or not
Active project and community so that I can rely on it in the future.
Compatible with MySQL
Maybe some things I do not know about?
I am hoping my answer fits your needs , its in two parts :
1- Zend Acl + Zend + Auth :
very robust code and 100% unit tested
it could support any encryption method or create your own method
it can support any backend you like [mysql , msssql , or even a session based auth]
custom acl to fits your application needs
you may choose php5.2 version = ZF 1.11 or the php5.3 = ZF2 beta released the last week
in ZF2 beta you could use the pyrus to package the required classes only , not the whole library http://zend-framework-community.634137.n4.nabble.com/Packaging-and-distribution-of-ZF2-td3597632.html
its very active project
2-symfony2 security component :
in sf2 you combine the [ACL , AUTH] in very powerful library called security
symfony2 has the support of bundles , and the FOS UserBundle its the ideal match for my usage
you can use it in your own project as its
Symfony's security component is available as a standalone PHP library for use inside any PHP project. http://symfony.com/doc/2.0/book/security.html
it support many backend solutions , they called providers you my see even create your own custom provider
you can even create many protected areas , in case you need it via firewalls , its basically as DMZs
support any encryption method you might need , or create your own
its very active project too
probably you can try this link: php user authentication libraries / frameworks ... what are the options?
zend_auth & codeigniter
it seems that the zend framework has good tools but it is overkill to do authentication only
ulogin, http://ulogin.sourceforge.net/
using social media login might also be another way

Use components from symfony 2.0 in symfony 1.4

Is it possible to use components from symfony 2.0 in symfony 1.4
project. If so, would you explain how to do it right?
I want to use new Routing in my project.
I would doubt that anything from S2 will work in S1.x. Symfony2 will only work with PHP 5.3 and greater and uses a totally different architecture from 1.4.
As the routing is a key component of the architecture then the chances of it working in a totally different architecture would be vanishingly small. Probably just as well to just use S2 if you want it's routing.

Categories