SiaMensiS Posted December 12, 2012 Share Posted December 12, 2012 I was wondering how realistic it would be to manipulate php so it works more than just a web application? Let me elaborate... I am looking into creating a "program" that is run mostly on php and mysql. Users would interact with it as though it was a web application ( ie. through the web browser ), however it will do more than just save to a database or return information. I want it so it runs off one server, accessed by other PC's on the network, but will have the ability to print to printers, read from bar scanners, etc. You may wonder why I'd want to do it in php and not a proper programming language, but this is because I like the idea of how easy it is to change the code etc. Ideally my question is, is this achievable with just php and mysql or would I need more ( such as ruby on rails etc ). I'm still a novice and haven't work with php much in the real world so if this question is an obvious yes or no please excuse me. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/ Share on other sites More sharing options...
kicken Posted December 12, 2012 Share Posted December 12, 2012 The PHP code would only run on the server. PHP does have a printer extension for windows that you could use to send print jobs. Similar could be done on linux by using exec calls to the proper commands. As far reading barcode scanners, that would be something you'd have to handle on the local client through some other language. I've no experience with such devices so I can't say much more than that. Basically you can use PHP to do non-web things, but you have to keep in mind the client-server relationship and realize that your PHP code running on the server won't have access to things on the client PC such as scanners or the PC's files. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/#findComment-1399025 Share on other sites More sharing options...
Christian F. Posted December 13, 2012 Share Posted December 13, 2012 If you don't want it to be available from the internet, then you could just set up a web-server environment on the Point of Sales (POS) computer. Or have it run on a server, and then use a local PHP-CLI component to deal with the bar scanner. It is even possible to write a GUI application with PHP, but that's more of an afterthought and thus not really recommended. Unfortunately things such as bar scanners aren't really designed to be used in a client-server application environment, which means you'll have to take a lot more care to ensure that the communication between the client and server parts goes smoothly. Since you already would need a local client to deal with the input from the bar scanner, I'd recommend writing the entire sales interface as a local client. You can still have it communicate with the server, upon closing the sale, fetching the inventory list and stuff like that. In short: I'd recommend using a different language for the sales and bar scanner interface, one that's geared towards GUI applications. Preferably one that has an API for the bar scanner available. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/#findComment-1399108 Share on other sites More sharing options...
trq Posted December 31, 2012 Share Posted December 31, 2012 We use barcode scanners with the applications I work on with at work. They communicate to PHP on the server without issue, client side, the data is handled by Javascript. From there, its just simple Ajax calls. In regards to printing. Most of our printing is done via PDF's. We have a Java applet that handles the client side of things, but a lot of this could potentially be done via the native browser print dialogs. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/#findComment-1402464 Share on other sites More sharing options...
Christian F. Posted December 31, 2012 Share Posted December 31, 2012 Hmm.. Didn't know there were scanners that were supported by JS. Thanks for that knowledge. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/#findComment-1402468 Share on other sites More sharing options...
trq Posted December 31, 2012 Share Posted December 31, 2012 The scanners just send a string of data. This can easily be captured as input, no different to someone using a keyboard and a form. Quote Link to comment https://forums.phpfreaks.com/topic/271905-php-as-more-than-just-a-web-application/#findComment-1402477 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.