Jump to content

Php As More Than Just A Web Application?


SiaMensiS

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.