filmov
tv
PHP Chat application (Complete Project) [+SOURCE CODE]

Показать описание
This is a real time chat application created using pure PHP.
The application doesn't use any frontend or backend framework except jquery which is a library just to reduce the javascript syntax so the project is frameworkless if you want
Along with php and mysql, I used AJAX for sending requests and perform actions without refreshing the page, and some other techniques like long polling wich is used to simulate the real time between users when they exchanging messages
The application contains too many features including exchanging messages between users asynchronously in form of organized components, a real-time notifier when users chatting, reply to certain message, add friends, accept friendship requests, follow a friend to be able to see his posts and have conversation with him, sharing posts in different forms including textual posts, post with one image, or more and video posts as well and too many features .
When you have friends OR follow people, you're gonna be able to fetch their posts either by checking your timeline or to navigate for certain user to see his posts. The user can also like posts, comment on posts, and share a particular post.
There's a profile page where the user could change his personal information and see his own posts or there's a setting page where the user can change everything in there including the password, username, cover .. etc.
Messaging section is implemented using long polling method, where the user sends a request to the server and tell the server to not close the connection until he gets some new data to that user; when the server get a data from another user to that userit will automatically send it back to that user and close the connection. When that client get the data or response from the server by automatically seeing it in the screen, the connection will be closed, and this user will send a new long polling request again to the server to wait for some new data and this process will be repeated until the user close chat section or the application. If you're using a framework you may use websockets which is better than long polling but because I'm not using any framework here I used long polling method to create this real-time channel between users to exchange messages and generate this notifier.
Notes:
1. This is one of my side projects that I written to apply everything I've learned in PHP and also to challenge myself by creating a chat application without any framework because I like to know how things happen behind the scenes. You may find some misuses or mistakes like in the way how I implemented the rest api or in the way how I structured the project ! but as I said this project is created just for learning and testing stuff, so you may pick up something useful and I'll very happy to see your feedback or any idea that makes that project much cleaner and useful.
2. The code will be available to anyone and I'll let the link to the code in the description, so If you want to collaborate, the code is available in github so you can make changes.
3. If you're using a framework like laravel or symfony, you can grab the project and try to convert it to a framework project and that will be a challenge that makes you understand framework concepts much better.
Комментарии