Jump to content


Photo

Php As More Than Just A Web Application?


  • Please log in to reply
5 replies to this topic

#1 SiaMensiS

SiaMensiS

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 12 December 2012 - 10:30 AM

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.

#2 kicken

kicken

    Wiser? Not exactly.

  • Gurus
  • 2,714 posts
  • LocationBonita, FL

Posted 12 December 2012 - 05:30 PM

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.

Recycle your old CD's, don't trash them!
Did I help you out?  Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#3 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 13 December 2012 - 04:25 AM

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.
Keeping it simple.

#4 trq

trq

    Advanced Member

  • Administrators
  • 31,025 posts
  • LocationSydney, Australia.

Posted 31 December 2012 - 05:12 PM

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.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#5 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 31 December 2012 - 05:30 PM

Hmm.. Didn't know there were scanners that were supported by JS. Thanks for that knowledge. :)
Keeping it simple.

#6 trq

trq

    Advanced Member

  • Administrators
  • 31,025 posts
  • LocationSydney, Australia.

Posted 31 December 2012 - 06:23 PM

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.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com