Download the PHP package tuyenlaptrinh/php-mega-nz without Composer

On this page you can find all versions of the php package tuyenlaptrinh/php-mega-nz. 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 php-mega-nz

php-mega-nz

A php API wrapper to connect to mega.nz API, in full object oriented mode.

This library takes care of not disabling https certificate checking when calling for mega servers.

This API is in construction, only few of its methods are available, but contributions are welcome!

This library is inspired by the smartinm/mega-php-client library and the tutorial by Julien Marchand.

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

For downloading the files of a folder on mega, and put them into a folder on your filesystem, please look at the example script.

This library offers an API to see files, and download them, as follows :

The constructor needs the full url to access mega. This means that the url fragment should contains the node id, and the key to decode the node. Mega::__construct(string $full_url):Mega

Once a new Mega object is created, you may search for its root folder with the method : Mega::getRootNodeInfo():MegaNode;

Once you have a MegaNode object, you may search for its children with the method : Mega::getChildren(MegaNodeId $node_id):MegaNode[];

The MegaNodeId object may be obtained with the MegaNode:getNodeId():MegaNodeId method. Node Ids are common objects to refer to specific nodes in a hierarchy, and the Mega class may retrieve MegaNode objects with the method Mega::getNodeInfo(MegaNodeId $node_id):MegaNode.

To separate nodes that represents folders and node that represents files, use the MegaNode::getNodeType():integer method. If the value is MegaNode::TYPE_FOLDER, then the node represents a folder, and if the value is MegaNode::TYPE_FILE, then it represents a downloadable file.

Then, to download files (folders are not downloadable for obvious reasons), use the Mega::downloadFile(MegaNode $node):string method, that returns the raw string data of the downloaded file, unencrypted.

Beware that this method does not uses streams directly to your filesystem, and may use a lot of memory if the file is really big.

To check the size of a file (folders have no size given Mega's API), use the MegaNode::getNodeSize():integer method. Beware that 32 bits system (or 32 bits php as windows have) may not handle the file sizes for large files very well.

Finally, almost every method of this library throws PhpExtended\Mega\MegaException dues to various factors, mainly because cryptographic errors that may occur anywhere. Remember to encapsulate calls to this library with try { ... } catch(MegaException $e) { ... } blocks.

License

MIT (See license file).


All versions of php-mega-nz with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
ext-mcrypt Version *
ext-openssl Version *
ext-curl 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 tuyenlaptrinh/php-mega-nz contains the following files

Loading the files please wait ....