Download the PHP package wethersherbs/pineapple without Composer

On this page you can find all versions of the php package wethersherbs/pineapple. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pineapple

Pineapple

An API-compatible replacement, forked from and for PEAR DB.

master v0.3-dev
Build Status Build Status

This repository has moved (is moving?)

From August 2022, this repository will move from https://github.com/wethersherbs/pineapple to https://github.com/may-den/pineapple. Older references should still work, an archived fork will remain on the older URL for compatibility purposes. Please update any references, bookmarks, and composer/packagist references accordingly.

What?

A compatibility layer around PDO or Doctrine DBAL to provide backward compatibility to PEAR DB-based applications.

It's close to (but is not) a drop-in replacement; You'll need to make modifications to your application, but they should be minimal.

Why?

PEAR DB is very old (the copyright range ends 9 years prior to Pineapple's inception), and was obsoleted by MDB2, which has in turn become obsolete. Projects have been based on these modules, but need an upgrade path that means new code can be developed using modern DB access methods, whilst retaining access for legacy code without opening a second database connection.

Ultimately, it'll provide backward compatibility for everything you've done, and leave you to write something more modern for your future work.

How?

This package is a fork of PEAR and DB, heavily refactored. The purpose of it is to provide a method-compatible drop-in replacement, reproducing PEAR::raiseError and PEAR::isError, and all methods under the DB class. Connection-specific drivers are dropped and only two connection drivers are included: DoctrineDbal, a driver which takes a constructed doctrine/dbal object, and PdoDriver, a driver which takes a constructed PDO object. It is intended only as a path to PDO or Doctrine DBAL migration, to keep legacy systems working whilst retaining a single database connection per application.

The intention is to strip unused methods, clean (remove all warnings and notices), make PSR-2 clean and provide full test coverage of the DB compatibility layer. Global constants will be replaced with class constants to maintain a clean constant namespace.

It is up to your application to cache the constructed database connection object. Please do not use Pineapple to retrieve your connection object after it has been dependency injected.

Usage

In Doctrine DBAL mode:

In PDO mode:

Integrating into your project

Changes to class names

Firstly, you should be aware of the following changes to class names. If you typehint, use instanceOf or methods which check class name, you will need to be aware of the follow changes to class names:

Old class New class
DB Pineapple\DB
DB_Error Pineapple\DB\Error
DB_result Pineapple\DB\Result
DB_row Pineapple\DB\Row
DB_common Pineapple\DB\Driver\Common
PEAR Pineapple\Util
PEAR_Error Pineapple\Error
PEAR_Exception Pineapple\Exception

 Changes to constants

Secondly, the PEAR_ and DB_ global constants (defines) are now class constants and will need to be scoped accordingly. Anything starting PEAR_ resides within Pineapple\Util, and anything starting DB_ resides within Pineapple\DB. We recommend namespace aliasing, e.g.:

Deprecated methods & variable access.

Thirdly, significant chunks of both PEAR and DB have been unapologetically stripped out and discarded. Anything within the PEAR class which is not:

...is now gone. Calling the above methods both as class methods and static methods is retained (it has been determined that both methods are in vigorous use in examined code).

All of the DSN handling code is removed from the DB (now Pineapple\DB) class. It exists purely as a construction factory for driver classes and an override for error handling. The following methods are retained (everything else, e.g. connect()) is now removed:

Most significantly, the following methods have been removed from the driver classes:

Replace these with query placeholders (parameterised queries):

If DBMS-abstracted inspection is required, replace these with calls to Doctrine DBAL:

Sequence facilities should be implemented in SQL:

With the removal of the above methods, class variables are now a mixture of private & protected and will not be available to your application. Several "getters" (and some setters) have been provided for your convenience. See:

Changes to the _db property of a constructed driver object in order to switch database on-the-fly have been replaced by calls to method changeDatabase.

Lastly, autoPrepare and autoExecute will no longer perform an UPDATE or DELETE without a WHERE clause. Change this behaviour by calling method setAcceptConsequencesOfPoorCodingChoices.

Code change summary

Test suite

A suite of tests to aid in regression testing whilst refactoring has been built. Every attempt to reach 100% coverage across all methods and classes has been made. Please ensure the test suite is run before submitting patches or pull requests.

A script to run the suite has been put into the project's composer.json file. To execute it, run:

Unfortunately, composer squashes the colourised output which helps indicate failures whilst running interactively. If you wish to view the output with colourisation, run:

We recommend that all changes are tested across the support PHP matrix (5.6-8.1).

Credits

Pineapple is the work of:

A multitude of thanks should be given to Mayden for supporting the author to complete the initial release of Pineapple.

The DB authors should take the most credit; the source was forked in its entirety for the refactor.

The following credits were taken from DB:

And these from PEAR:

Please see the file "CONTRIBUTORS.md" for other attribution.

License

Upstream PEAR is distributed under the BSD 2-clause license. This license is retained. This applies to classes Util, Error and Exception.

Upstream DB is distributed under the PHP License http://php.net/license/, which is a BSD-style license. This license is retained. This applies to all other classes and includes DoctrineDbal, which is derived from DB_mysqli (no longer included in this package).

Any additional code or test suites are provided under the PHP License http://php.net/license/.


All versions of pineapple with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-pdo Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wethersherbs/pineapple contains the following files

Loading the files please wait ....