So lately I've been thinking of building and implementing my own invoice system with PHP and I want to have an optional 'Download/Generate PDF' button that creates a PDF based off of either a template that was created or based off of html/css.
I want a method that is free (seeing as some are ridiculously overpriced) and hopefully not too difficult to use. The end goal is to create something that would be good enough for commercial use (though it's not my intent to sell it).
I've heard of options such as TCPDF, Dompdf, wkhtmlpdf etc. But again I'm looking for one that would render most correct, and potentially be used commercially. I'd like suggestions specifically based off of what I require as I have searched the site for topics that are similar; I'm aware of the different libraries but not sure what I should use.
Thanks in advance! :)
Having done this a couple times, my suggestion would be to take an existing library that wraps up the low level PDF tools into a decent API, and then build your own library that is specific to your needs (invoicing) on top of it.
I would suggest Zend PDF or TCPDF as a base library to build on. As you add classes to your own library you'll be able to wrap up things like table / line-item generation, headers, footers, etc.
I used FPDF library, I liked it. http://www.fpdf.org/
and check this manual anyway: http://php.net/manual/en/book.pdf.php
I'm often suspicious about low-level reporting systems (TCPDF et al) - they're very well done, but if a business needs a new report, it can take ages to write code to draw the report to client requirements. I therefore prefer GUI/server solutions, such as iReport (used to design a report) and Jasper (reporting server) - the editability of such a report is near-instantaneous, and thus much more responsive to changing business requirements.
On the plus side, it's free and open source, and on the negative side, you'll need a spare server to run it on. It's Java based, but reports can be run via PHP using SOAP.
If you can use external tools, I recommend wkhtmlpdf. It is really simple to use.
Check out the "Integration With PHP" on their wiki: https://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp
Related
A reason I've picked up working with the Zend Framework was that I keep hearing how easy it is to reuse code and not have to reinvent the wheel every time you start a new project.
I do find this true for my own code, but find it pretty hard to find quality external sources that can integrate well into the system.
Anyway, I'm basically looking for pre written PHP code (preferably supported by frontend js scripts) that s flexible and wraps the most common tasks relating to image management. (cropping scaling, validation of mimetypes/sizes/dimensions etc) into a useful/flexible class.
Any recommendations?
Thanks
Anyway, I'm basically looking for pre written PHP code (preferably supported by frontend js scripts) that s flexible and wraps the most common tasks relating to image management.
I'm not sure you're going to find a complete general-purpose drop-it-in component for this, but you can stitch something together without a problem.
jcrop is a jQuery plugin to handle the client-side bits of image cropping.
Imagine is a new PHP image handler, wrapping either GD or the Imagick/Gmagick extensions. It has a powerful, convenient, fluent interface with comprehensive cropping, thumbnailing and resizing support.
As for gluing them together, that'll be up to you... but given that these two libraries can handle most of the work, it should just be some quick bits and pieces in your controller code.
You might want to check Nette Image. It has far the best interface I've seen ;)
It's true that code reuse isn't very complicated, but making pieces of code from all over the place work TOGETHER can be very complicated. Have you looked into using a more general purpose framework like CakePHP?
Have a look here: https://stackoverflow.com/questions/2648/what-php-framework-would-you-choose-for-a-new-application-and-why
I need to implement wiki-like functionality within a website.
Problem is that I am not fully aware of what it might require and therefore predict a long set of refactoring till I actually nail a good version.
I tried looking for some guidelines, but haven't found much.
Any ideas? Help would be wonderful
There's an industry standard there. If it was me and I was called upon to write a technical requirements document for a new Wiki, I'd start with the features page of Wikipedia. Then, I'd attempt to use the tools in a dev operation, determining the strengths and weaknesses of the implementation. Wikipedia is built for the masses, so there's certainly improvements you can make on the interface and layout that will better suit your needs if you choose to go this route.
Documentation and a roadmap is key to less factoring in development (regardless of language) If you go in without a plan, you'll inevitably cause yourself headaches and require yourself to go back to refactor. It's always better to build with a goal in mind and stick to a quality plan. Obviously, we all know in this industry that the other key is to realize that often those plans are well intentioned but woefully short, so those of us who are most able and willing to adapt are going to be the most likely to succeed.
Is there a specific reason you cant utilise an off the shelf project? DokuWiki is PHP based and easy to set up, once you deploy you then can easily alter to fit your needs if you have knowledge of PHP...
Rather than re-invent the wheel, I'd suggest you have a long look at DokuWiki. Not only does it provide a very simple method for embedding PHP within Wiki apges (I've built several applications relying on just this) its easy to extend and the rendering engine is easy to embed into your own code. An easy way to use the rendering engine is to just write your app as a DokuWiki template.
http://code.djangoproject.com/wiki/DjangoResources is listing several wiki applications for django.
You may be able to use one for your project as least as a source of inspiration.
I hope it helps
If you can live with simple wiki functionality without all the typical wiki syntax, try plugging a dooWiki into to one of your pages. What's nice is that there's no software involved and there's no third-party branding or advertising to deal with.
If I have a REST based service written in the Symfony [symfony-project.org] framework (i.e. PHP), is there any decent tools/frameworks out there that will parse my code and generate API documentation?
The Java based framework enunciate has documentation capabilities similar to what I need, you can view an example of this here: http://enunciate.codehaus.org/wannabecool/step1/index.html.
I understand the premise of REST based services are supposed to be self evident, however I was after something that would generate this documentation for me without the need to manually write up all my endpoints, supported formats, sample output etc.
Thanks
Not sure if you've seen Swagger before. They seem to have a PHP compatible version, though I can't really vouch for it personally. It does some automatic API documentation generation comparable to enunciate, though it does look like it requires some heavy manual documentation via PHP comments. That being said, I think the manual effort will be the same or less than making your own via wiki pages, and the output is much, much nicer.
Just as a factoid, it looks like Enunciate has indefinite plans to eventually support other platforms, but the relevant Jira ticket is currently Open waiting for a sponsor to take on the work.
From the ENUNCIATE-356 Jira ticket:
The first step to supporting other languages is to decouple the Enunciate model from the Java model. This work is being tracked and logged at ENUNCIATE-584. Unfortunately, it never made it out of the investigate phase because of how heavy it is. Unless a sponsor for the work is found, I don't anticipate taking that heavy load on anytime soon.
Edit:
Found a similar question where someone mentions a GitHub project dedicated to Swagger+Symfony2. This other question is the same, but no additional information.
To my knowledge there is no way to automate the documentation of media types.
If you are using a media type like XHTML then a web crawler like Google sitemap may produce some useful output to show the relations between your resources.
I'm currently developing (another) Open Source CMS in PHP and I'd like to use javascript controls especially for the admin panel. The question is, are there any open-source, freely distributable controls (for creating javascript Editable Grids, Trees, tabs etc ) that have an interface for PHP ?
I've experimented with ExtJs in the past but although its usability and beauty when it comes to implementing it with php, it's a frustration. I've also tried PHP-EXT and ExtPHP libraries but I was disappointed by their generated code, their limited implementation of ExtJs and lack of proper documentation.
Coolite is a nice implementation for .NET but I haven't found anything similar for php. That surprised me, taking into account the years of php development on the market.
Off course there's always the option of implementing different libraries for each component but this would become an overwhelming task, besides the incompatibilities and the difference in look&feel that are going to come up.
Any suggestions?
Thank you in advance.
I really like jQuery with their new jQuery UI. Also, browse through their plugins list for more tools.
But you might like mootools too.
Really the best thing to do is just to write the JavaScript interactions between your JS library and PHP yourself. Overall generated code wil never be fully changeable and most JS libraries take a mere day to learn how to use.
Best bet is to go with jQuery and jQuery UI as it has a lot of documentation and support.
You might also like the Yahoo! User Interface Library which might be closer to Coolite.
There is one framework I've seen for producing thick client web apps called Cappuccino. Might be overkill for what you want to achive, but the demos just look so tasty.
one of the most frequent requests I get is to create XY report for YZ App. These apps are normally built on PHP, so far I have manually created most of this reports, and while I enjoy the freedom of building it as I want, it usually becomes pretty tedious to calculate subtotals, averages, exporting to different formats etc.
What solutions are out there (free/OSS preferred) that help me get this repetitive tasks cranking?
edits:
I'm talking about reports/summaries from SQL data. Many times from DBs not designed for reporting use.
while I'm aware of "business-intelligence" we're not ready to implement a full scaled "intelligence" structure, looking more for a helper of sorts...
The problem you're facing is solved by so-called Business Intelligence software. This software tends to be bloated and expensive, but if you know your way around them you will be able to crank out such reports in no time at all.
I'm only familiar with one particular proprietary solution, which isn't too great either. But a quick search turns up the following page, which lists a number of free/open source alternatives:
http://en.wikipedia.org/wiki/Business_intelligence_tools
It depends on what kind of reports you're talking about. For example... site stats... you could install google analytics and the client could export whatever format they wanted.
A little Google search gave me the following OSS:
RLib
http://rlib.sicompos.com/
PM Report
http://www.hotscripts.com/Detailed/48187.html
I don't have any information on them, sorry.