D
D
Dmitry Filippov2015-04-27 20:19:42
PHP
Dmitry Filippov, 2015-04-27 20:19:42

How to properly build a class to work with users in php?

I'm working on the engine. You need to write a class to work with users. What should be in such a class? What methods? What should this class be able to do?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2015-04-27
@OnYourLips

Depends on that pattern on which you implement operation with basis.
What framework do you use?
In general, you need 2 controllers: authorization / registration / password recovery and profile.
As for the model, it is 1-4 classes.

D
Dmitry, 2015-04-27
@By_Engine

If you don't know what a class should implement, maybe you don't need it?

A
avada kedavra, 2015-04-27
@kedavra

Entity class (just sets/returns properties) and handler class (authorization, registration, remember me functionality). You can also class-mapper (delete, add, select from the database), if not, then use activeRecord and shift these functions to the entity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question