PHP code example of nachonerd / silex-finder-provider
1. Go to this page and download the library: Download nachonerd/silex-finder-provider library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nachonerd / silex-finder-provider example snippets
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
// Dump the relative path to the file, omitting the filename
var_dump($file->getRelativePath());
// Dump the relative path to the file
var_dump($file->getRelativePathname());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByModifiedTimeDesc()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByChangedTimeDesc()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByAccessedTimeDesc()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByTypeDesc()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByNameDesc()->in(__DIR__);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->sortByChangedTimeDesc()->in(__DIR__);
$finder = $finder->getNFirst(10);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
= new Silex\Application();
// Considering the config.yml files is in the same directory as index.php
$app->register(new \NachoNerd\Silex\Finder\Provider());
...
$finder = $app["nn.finder"];
$finder->files()->in(__DIR__);
$finder = $finder->getNFirst(10);
foreach ($finder as $file) {
// Dump the absolute path
var_dump($file->getRealpath());
}
...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.