Download the PHP package restoore/therefore without Composer
On this page you can find all versions of the php package restoore/therefore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download restoore/therefore
More information about restoore/therefore
Files in restoore/therefore
Package therefore
Short Description Integration package of Therefore Web API into Laravel applications
License MIT
Informations about the package therefore
laravel-therefore
This a package to integrate Therefore Webservice with Laravel 5. It includes a ServiceProvider to register the webservice. You also have facade to use increase the webservice usage.
Installation for Laravel 5.x
Require this package with composer :
After updating composer, add the ServiceProvider to the providers array in config/app.php
If you want to use the facade add this to your facades in your app.php
Copy the package config to your local config with the publish command :
Copy migration files to your local migration folder with the publish command :
Launch migration :
Configuration
If you have used the following command :
You've a therefore.php in your local config path, by default : /config/therefore.php, if not, you have to create this file. In this file, you have four parameters that have to be returned in an array :
- wsdl, url of your therefore wsld file
- login, your therefore account login
- password; your threfore account password
- file_path, file location where your want to save files and thumbnails. All files will be saved in your laravel public folder. For exemple, if you put docs/therefore/, all files we be created in public/docs/therefore/
Environment
If you want to use different environments of development, you can override wsdl, login and password parameters by using .env file.
Usage
You can now connect your model to Therefore document by using php traits. First, you have to add ThereforeTrait to your model :
Now you have to configure attributes to bind your model to Therefore documents :
- $thereforeCategoryNo will contain CategoryNo from your Therefore document
- $thereforeFieldNo will contain the id of the field you want to use to link Therefore document and your model
- $thereforeSearchableField will contain the name of your model attribute witch will be used to linked your model This should looks like this :
In this example the model id have to be the same that the value in the field 92 of the Therefore document.
Retrieve documents and files
Now you can use function listDocuments to retrieve all linked documents of your model. For example :
will produce for my example :
refreshCacheFiles will check if you have last version of documents and update database and files. You can decide to not use this function everytime and let user manually refresh file list.
Now if you want files of a document :
Here you have file model structure :
All attributes of ThereforeDocument and ThereforeFile can be reachable with their names. For example :