Download the PHP package andrey-helldar/sitemap without Composer
On this page you can find all versions of the php package andrey-helldar/sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andrey-helldar/sitemap
More information about andrey-helldar/sitemap
Files in andrey-helldar/sitemap
Package sitemap
Short Description A simple sitemap generator for PHP Framework.
License MIT
Informations about the package sitemap
Sitemap for Laravel 5.6+
A simple sitemap generator for PHP Framework.
Attention!
This package is abandoned and no longer maintained. The author suggests using the
spatie/laravel-sitemap
package instead.
Installation
For the 5.4 and 5.5 version of Laravel Framework, use version 3.
To get the latest version of Laravel Sitemap, simply require the project using Composer:
Instead, you may of course manually update your require block and run composer update
if you so choose:
If you don't use auto-discovery, add the ServiceProvider
to the providers array in config/app.php
:
You can also publish the config file to change implementations (ie. interface to specific class):
Now you can use a app('sitemap')
method.
Upgrade Guides
- Upgrading from 4.x to 5.x
Configuration
To configure the generation, you need to fill the models
array in the config/sitemap.php
file:
As the key of the array, you must use the model name for which the rules will be defined.
- route - the name of the route to generate the URL.
- route_parameters - the parameters to be passed to the URL generation method, where:
- the key is the parameter name for the routing. If the name of the routing parameter matches the name of the column in the database, you can specify only the value.
- the value is the name of the column in the database to substitute the value. If the value needs to be taken from the link, then you should specify the appeal through a point. For example:
'bar' => 'my_relation.slug'
.
- lastmod - is the name of the column containing the record date. In case of absence, the current date is used. If the model does not need to take into account the time field, set the parameter
lastmod
tofalse
. - frequency - is the value of the refresh rate of the content. This is necessary for some search robots. You can also use constants from
Helldar\Sitemap\Services\Sitemap
class. - priority - is the priority of the reference for model records.
If any of the model values are undefined, a global value will be used.
Using
Manual
You can also transfer an array of items created manually:
Returned:
Also you can combine the data from the models builders with the transferred manually:
Images
Your can also transfer an array of image items created manually:
Returned:
Attention! Due to the different structure of documents, when trying to call method show()
, an image map will be shown only if there are no calls to other methods.
Example:
The same principle applies when saving to one file - images will be ignored. But when saving to several files, the map will be successfully created.
Show
To display the content on the screen, use the show()
method:
To return the content of the page, add any route:
And go to your URL. Example: http://mysite.dev/sitemap
.
Save
If the option separate_files
is DISABLED
To save the contents to the file, use the save()
method:
If you want to save multiple files, pass the path to the file as a parameter to the save()
method:
If the option separate_files
is ENABLED
To save the contents to the separated files, use the save()
method with 'separate_files' => true
parameter in config/sitemap.php file.
In this case, the name of the file will be the default name from the settings: 'filename' => 'sitemap.xml'
. The files are saved through the Storage
facade (see config/sitemap.php).
Each model builder will be processed and saved in a separate file, and the shared file will contain references to it (with the selected a public
storage name):
If you use a multi-domain application, you can specify the domain names of the generated links to other files, having pre-specified them in the settings:
This method will create files with the following links:
and
By default, the domain specified in APP_URL
of .env
file will be used.
If you want to save multiple files, pass the path to the file as a parameter to the save($path)
method with 'separate_files' => true
parameter in config/sitemap.php file:
Files will be created:
SEO
Sitemap is extremely useful when indexing a site by search bots. If you use a sitemap splitting into several files, you only need to add a link to the main file in the robots.txt
file.
For example, you created several files:
In the robots.txt
file, you only need to specify a link to the main file:
All the rest of the search bots will do for you.
Enjoy!
License
This package is licensed under the MIT License.
All versions of sitemap with dependencies
ext-dom Version *
dragon-code/xml-core Version ^2.1
illuminate/database Version ^5.6 || ^6.20.26 || ^7.30.3 || ^8.22.1 || ^9.0
illuminate/support Version ^5.6 || ^6.20.26 || ^7.30.3 || ^8.22.1 || ^9.0
nesbot/carbon Version ^1.25 || ^2.0
symfony/http-foundation Version ^4.0 || ^5.0 || ^6.0