Welcome to all our readers on our website at www.tutorialpath.com. As you all know that here on our website we will provide you lots of information related to the latest and newly introduced technology which help you to get updated with the latest tech. Here you will get all the useful information which is required in this tech world. As you know technology is one of the trending part in this world. So, here again we came up with a latest and new tech information which is related to the process of creating Php State Management. With the help of this article you will get to know the complete process of how to create Php State Management in a step by step manner. So, simply have a look to this article and grab all the useful information which is going to be very helpful for you.
Introduction to State Management
HTTP is a stateless protocol, which means that each user request is processed independently and has nothing to do with requests that have been processed before. Therefore there is no way to store or send specific details of any user using the HTTP protocol.
But in modern applications, user accounts are created and user specific information is shown to different users, for which we need to have knowledge about who the user (or what he/she wants to see etc) is on every webpage.
PHP provides for two different techniques for state management of your web application, they are:
- Server Side State Management
- Client Side Server Management
Server Side State Management
In server side state management we store user specific information required to identify the user on the server. And this information is available on every webpage.
In PHP we have Sessions for server side state management. PHP session variable is used to store user session information like username, userid etc and the same can be retrieved by accessing the session variable on any webpage of the web application until the session variable is destroyed.
Client Side State Management
In client side state management the user specific information is stored at the client side i.e. in the browser. Again, this information is available on all the web pages of the web application.
In PHP we have Cookies for client side state management. Cookies are saved in the browser with some data and expiry date(till when the cookie is valid).
One drawback of using cookie for state management is the user can easily access the cookie stored in their browser and can even delete it.