frameworks for coding a php library? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
there are plenty of frameworks for coding MVC web applications.
this time im going to code a library (think of Doctrine or Solr) with a bunch of class files. u just include a bootstrap or a class file and you are ready to use my classes.
i have never tried to code a library before and intend to code one for learning purpose so that i can use various design patterns i have learned.
are there any great frameworks for this, how i should organize the different class files, where i can put configuration files and so on?
tutorials or other information would be great too.
thanks
UPDATE: its just in general, not something specific. im wondering if there is a "pattern" just like for web applications (MVC): should it be one file he includes and that file will include all other class files? should it be a class file he includes or a so called bootstrap file? in short, i need to know how to code a library so every developer could use it the open source way

Library code covers so many diverse areas that it's hard to imagine a general framework for library development.
Generally speaking, you should strive to create a library that is (among other things):
Consistent - Your library's API should be as consistent as possible. For example: do you pass standard argument lists to constructors, or a single $config array containing name/value pairs? If you favor factory methods, implement them consistently across the whole library.
Efficient - avoid loading classes that aren't needed. Figure out how to manage dependencies - don't just load every class from some central bootstrap script. Consider a directory structure like that used by PEAR or Zend Framework. This can help you integrate with various autoloaders that your users may already be using.
Testable - a library with good tests that cover it is more valuable than one without.
Documented - Get cozy with PHPDocumentor, and be prepared to write additional documentation that is heavy on example client code.

There are no general library frameworks. You will find plugin APIs, or similar, if you are developing for other software. In that case, use them. Otherwise, there are no assumptions to be made on how a library should work and therefore no framework, other than a programming language, to house it.
All libraries tend to have a bootstrap though that include all other essential files. Additional classes and files might be loaded through a registered autoloader.

Related

PHP session handling to save to database [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Learning PHP, the most frustrating hurdle for me seems to be weeding through outdated tutorials, blog and forum posts to find relevant, modern guides.
I want to understand how to implement saving sessions data to databases the right way. However, most of the instructions I can find regard custom session handlers, and seem to be many years old, and this concerns me. I don't want to waste my time learning outdated procedures. Are custom handlers still the way to accomplish this? Are there better/newer modes of storing sessions to db's? I would greatly appreciate anyone taking the time to point me in the right direction. Many thanks!
To confirm what #rickdenhaan was saying in comments, custom handlers is the right way to go.
PHP doesn't provide a lot of different session handles. Maybe because Zend (which supports PHP) provide Zend Session tools.
To avoid reinventing the wheel you have to options :
Use a framework
That will handle all of this kind of stuff for you : session, MVC, ORM, config files etc
Most of the time this is the right choice for a new project, and Symfony and Laravel are great projects to start.
Use external modules
If you want a more modular approach, you can import externals modules with composer and create something that suits your particular needs.
This can be a great approach to refactor an existing project (either based on an old framework, or on legacy code)
And in this case, you still don't reinvent the wheel, you can use Zend Tools to handle your session :
https://github.com/zendframework/zend-session
Install it with composer and start working with it. Use it with built-in php tools session_set_save_handler()
I hope this answer your question in a broader way.

Event-Driven PHP Framework? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm wondering if there are any completely event-drive frameworks out there for PHP which are based around dependency injection for decoupling. I know there are some frameworks that make use of these patterns - but in the end the entire life-cycle of the application is still pre-defined and linear in style.
For example, most frameworks are built to receive, process, and return results from HTTP requests. An event drive framework would have handlers for that, but also be able to be used for new purposes like background processing, command line interaction, or other non-standard use cases.
It sounds to me like the Photon framework fits closest to your description - the key point is that you can't have event-driven code without php running in a daemon-like process. Your choice of webserver in fact dictates whether what you ask is possible or not - photon is dependent on mongrel2.
I have never used it for a project personally, but I believe that Prado covers what you are asking. It is componentised, but I cannot be sure about the dependency injection aspect.
From their site:
PRADOTM is a component-based and event-driven programming framework for developing Web applications in PHP 5. PRADO stands for
PHP Rapid Application Development Object-oriented.
I know of it because one of my university class mates designed the logo and website for the project.
Not used it, but I believe in addition to Prado, which Treffynnon has mentioned, Qcodo is a pure event-driven framework.
I was looking what is around as well and i came across p4e which is based on zend framework,and nette, hope it can help!
Off the bat there are these 2 as well:
Zend Framework 2 (still in beta)
symfony 2
Both have all the things you are looking for I believe.
Symfony2. Simple as that.
http://symfony.com/
Yii ,It is a component based and event-driven framework, Pure OOP and MVC. It is very clean and neat. Check it out.
http://www.yiiframework.com
The Qbix Platform is heavily event-driven in PHP, although it does not use dependency injection.
Reactphp is what you are looking for.

Open Source websites [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am teaching myself web development, and right now I'm using HTML/CSS/PHP, but I am having difficulty understanding how the code for sites should be structured to avoid lots of repeat code and things like that.
I was wondering if there were some slightly complex websites that were open source, so I could view all the code (including the php) to see how things are actually done so I can create websites properly by example of these opensource sites.
If you're considering to use MVC paradigm, I would suggest you to study how a web framework is designed and implemented (such as symfony, codeigniter, yii, ror or zend), in order to learn how a big web app is structured (requests, security, cache, logins, database, forms, etc...) and then try to design and build your own one.
This will teach you a lot of valuable concepts such as:
How MVC works (Controller->Model->View)
Application Bootstrap (Single Entry Point)
Directory Structures
Database Access Layers (ORM, DAO, Abstract Factory)
Session Handling
Form creation (forms, decorators, validators)
Cache implementations and benefits
Helpers
Routing (friendly url's)
If you design your own framework propperly you'll have a base structure for all your web apps, and a lot of classes for common functionalities ready to use on your site (login, forms, html, etcetera).
You don't have to implement everything, you can use some libraries for the most complex tasks. Such as Propel or Doctrine for the ORM, or APC for the cache system, or PDO for database access, or apache mod_rewrite for rewriting urls.
I did this and learnt a lot about how to make decent web app.
SourceForge is a website that lists millions of open-source projects free for you to use and download.
Look at Q&A system OSQA.net, it's similar to StackExchange QA sites, but opensource
StackOverflow (StackExchange powered QA system) is not opensource itself, info here:
https://meta.stackexchange.com/questions/14656/is-the-stack-overflow-source-code-available

PHP Framework / Library Suggestions for a Backend [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 months ago.
Improve this question
I am about to start to developing backend site of a php project. Companies and site admins will login to this site and manage their data on the project.
My previous admin panel experiences were full of agony and pain. So I want to make sure that I choose correct tools for my purpose.
By the way, please note, I'm not looking for scaffolding. There won't be much tables in my database. Instead, there will be complex logic between entities.
I want clear seperation of markup and logic code and easy-to-use and standardized user-interface.
Thank you.
Edit:
I understand this is very subjective. This is why I call it suggestion. I want to try a few of chunks of code before going along with one of them.
There is no perfect answer for this, it depends a lot of your (and your team) programming experience and your project's requirements.
As it talks about PHP and backoffice, I suggest you look at symfony framework. It's a RAD framework with great admin features and tons of plugins easing backpanel developement.
I understand you don't want scaffolding, in symfony you can choose to use a very customizable admin generator or build your own forms/listings (or mix between both, using generated as a good code base and extending it).
It comes with a great separation of concerns as it uses MVC paradigm, but aside from MVC it has form management sub-framework which can help a lot developing backoffice.
Be careful if you're not familiar with PHP5 OOP and MVC it could be little complex to learn and understand, but if your planning could allow you to have time to learn symfony programming, it's an experience I would recommand to every PHP developer.
This framework is very well documented, and as an introduction tutorial they offer a class around a website example with its backend application.
Of course, this is subjective and others would perhaps recommend you other choices.
Only recently went through a couple of frameworks about a month ago for a site I was working on and found CodeIgniter was easiest to get up and running and had the best documentation and tutorials.
http://codeigniter.com/
Alternatives are symphony, cakePHP and Kohona

What are some flexible, free CMS's for written in PHP for large websites? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a content management system (CMS) written in PHP for a large and diverse website. Here's what I'm looking for:
Design flexibility -- The look and feel needs to be completely customizable. Specific pages may need to have design elements
Modular design -- I want to be able to add features myself if they're needed.
Production ready
Advanced user permissions
MySQL or Oracle
What I can sacrifice:
Steep learning curve -- I am experienced PHP and RoR developer. I'm alright with needing to take a few days/weeks to learn it.
Performance -- we don't get much traffic.
SEO -- This is on a local intranet, no need for SEO. Pretty URLs are nice, but not required.
If there isn't a CMS that meets these needs, my last option would be to build one from scratch using Kohana 3.0, which I'm already using on a daily basis.
Background: At my place of work we're looking to redesign/develop our existing website hosted on a local network. This site consists of somewhere between 600-1,000 static HTML pages, many of which contain varying design elements (like jQuery tabs). Though the site is pretty big, we probably only get around 100 hits per day. There will be customers (no coding experience) and fellow web-developers modifying the content on these pages.
http://modxcms.com/ -> modx modx modx an etomite fork
Modx's REVO release is OOP, but might not be release ready, but the EVO release is tested and true :)
it's great for modular design, design flexibility and above all extensibility.
Especially given that you are willing to go through a bit of a steeper learning curve, with some php knowledge you'll be able to get a lot out of modx. Using the "usual suspects" can be limiting in the areas of extensibility, where though it is possible, but everything can feel like a hack.
I would say the usual suspects Joomla and Drupal. Added benefit of huge communities.
I have had good experience with Etomite
It allows you to plug-in PHP code easily, it has nice template structure as well as static (Chunks) and dynamic (Snippets) modules that can easily be added to any page or template. I also found it had a good security structure. It probably does not have such a large community but the support forums are sufficiently active.
Using Joomla and TomatoCMS is so good, MVC structure

Categories