Download the PHP package imanghafoori/laravel-self-test without Composer

On this page you can find all versions of the php package imanghafoori/laravel-self-test. 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 laravel-self-test

Find Bugs Before They Bite

microscope_header

Built with :heart: for lazy Laravel developers ;)

Why repeat the old errors, if there are so many new errors to commit?

(Bertrand Russel)

Give your eyes a rest, we will detect and fix them for you.

Packagist Stars Required Laravel Version Required PHP Version Latest Version on Packagist Quality Score Total Downloads Today Downloads tests Imports

Key things to know:

:film_strip: Video tutorial here

:star: Your Stars Make Us Do More

If you found this package useful, and you want to encourage the maintainer to work on it, just press the star button to declare your willingness.

Stargazers

⬇️</g-emoji> Installation

You can install the package via Composer:

You may also publish config file:

💎</g-emoji> Usage:

Useful Commands:

You can run :point_down:

# Artisan Command
1 php artisan search_replace
2 php artisan check:early_returns
3 php artisan check:all

Less Used Commands:

# Artisan Command
1 php artisan check:views
2 php artisan check:routes
3 php artisan check:psr4 {-s\|--nofix}
4 php artisan check:imports {-s\|--nofix} {--wrong} {--extra}
5 php artisan check:stringy_classes
6 php artisan check:dd
7 php artisan check:bad_practices
8 php artisan check:compact
9 php artisan check:blade_queries
10 php artisan check:action_comments
11 php artisan check:extract_blades
12 php artisan pp:route
13 php artisan check:generate
14 php artisan check:endif
15 php artisan check:events
16 php artisan check:gates
17 php artisan check:dynamic_where
18 php artisan check:aliases
19 php artisan check:dead_controllers
20 php artisan check:generic_docblocks
21 php artisan enforce:helper_functions
22 php artisan list:models

Global Helper Functions:

Also, You will have access to some global helper functions

In case you wonder what the listeners are and where they are, you can call microscope_dd_listeners(MyEvent::class); within either the boot or register methods. It works like a normal dd(...); meaning that the program stops running at that point.

📖</g-emoji> What do the Commands do?

Let's start with the:

php artisan search_replace {--name=pattern_name} {--tag=some_tag} {--file=partial_file_name} {--folder=partial_folder_name}

This is a smart and very powerful search/replace functionality that can be a real "time saver" for you.

:one: Defining patterns:

If you run the command artisan search_replace for the first time, it will create a search_replace.php file in the project's root. Then, you can define your patterns, within that file.

Examples:

Let's define a pattern to replace the optional() global helper with the ?-> php 8 null safe operator:

:two: Placeholders:

Here is a comprehensive list of placeholders you can use:

# Placeholders Description
1 <var> or <variable> for variables like: $user
2 <str> or <string> for hard coded strings: 'hello' or "hello"
3 <class_ref> for class references: \App\User::where(... , User::where
4 <full_class_ref> only for full references: \App\User::
5 <until> to capture all the code until you reach a certain character.
6 <comment> for comments (it does not capture doc-blocks beginning with: /** )
7 <doc_block> for php doc-blocks
8 <statement> to capture a whole php statement.
9 <name:nam1,nam2> or <name> for method or function names. ->where or ::where
10 <white_space> for whitespace blocks
11 <bool> or <boolean> for true or false (acts case-insensetive)
12 <number> for numeric values
13 <cast> for type-casts like: (array) $a;
14 <int> or "<integer>" for integer values
15 <visibility> for public, protected, private
16 <float> for floating point number
17 "<global_func_call:func1,func2>" to detect global function calls
18 <in_between> to capture code within a pair of {...} or (...) or [...]
19 <any> captures any token.

You can also define your own keywords if needed!

You just define a class for your new keyword and append the class path to the end of the Finder::$keywords[] = MyKeyword::class property. Just like the default keywords.

Example:

:one: Let's say you want to find only the "comments" which contain the word "todo:" in them.

Note If you do not mention the 'replace' key it only searches and reports them to you.

:two: Ok, now let's say you want to remove the "todo:" word from your comments:

Converts: Into:

:three: Mutator: In mutators, you are free to manipulate the $matched values as much as you need to before replacing them in the results. You can also mention a static method instead of a function, like this: [MyClass::class, 'myStaticMethod']

:three: Let's say you want to put the optional comma for the Lets elements in the arrays if they are missing.

In this case, our pattern is not very accurate and in some cases, it may result in syntax errors. Because of that, we turn on the php syntax validator to check the result, but that costs us a performance penalty!!! To exclude the usage of PHP, to validate the results we have mentioned the avoid_result_in so that if they happen in the result it skips.

If you are curious to see a better pattern that does not need any syntax checking, try this:

This is more complex but works much faster. (since it does not need the php syntax validator)

:four: Filters:

Currently, the microscope offers only two built-in filters: is_sub_class_of and in_array

Can you guess what the heck this pattern is doing?!

It converts these:

Into these:

So it does not tamper with something like this:

:five: Capturing php "statements":

Let's say we want to opt into php 7.4 arrow functions:

In this example, we have mentioned one single "statement" in the body of the function. So if it encounters a function with two or more statements it will ignore that.

But this is not captured:

:six: Difference between <statement> and <until>;

They seem to be very similar but there is an important case in which you can not use <until>; to cover it properly!

If we define our pattern like this:

For $c = $a + $b; they act the same way, but for the second one "<until>"; will not capture the whole closure and will stop as soon as it reaches $a++; and that is a problem.

But if you define your pattern as: '<var> = <statement>' it would be smart enough to capture the correct semicolon at the end of closure definition and whole close would be captured.

:seven: Capturing global function calls:

Let's say you want to eliminate all the dd(...) or dump(...) before pushing to production.

This will NOT capture cases like below:

But will detect and remove real global dd() calls with whatever parameters they have received.

:eight: Repeating patterns:

Let's say we want to refactor:

into:

Ok, how the pattern would look like then?!

Nice yeah??!

Possibilities are endless and the sky is the limit...

php artisan check:early_returns

This will scan all your Psr-4 loaded classes and flattens your functions and loops by applying the early return rule. For example:

Will be discovered and converted into:

The same thing will apply for functions and methods, but with return

Although this type of refactoring is safe and is guaranteed to do the same thing as before, be careful to commit everything before trying this feature, in case of a weird bug or something.

php artisan check:psr4

php artisan check:generate

You make an empty file, and we fill it, based on naming conventions.

If you create an empty .php file which ends with ServiceProvider.php after running this command: 1 - It will be filled with a boilerplate and correct Psr-4 namespace. 2 - It will be appended to the providers array in the config/app.php

php artisan check:imports

php artisan check:bad_practices

php artisan check:routes

php artisan check:compact

php artisan check:blade_queries

php artisan check:extract_blades

You can use {!! extractBlade('myPartials.someFile') !!} in your blade files to indicate start/end line and the path/name of the partial you intend to be made.

After you execute php artisan check:extract_blades it will become:

Also, it will create:

And put the corresponding content in them.

php artisan check:action_comments {--file=SomeFile.php}

php artisan pp:route

php artisan check:views

Also, it can detect unused variables which are passed into your view from the controller like this: view('hello', [...]); For that you must open up the page in the browser and then visit the log file to see a message like this:

Remember some variables are passed into your view from a view composer and not the controller. Those variables are also taken into consideration when detecting unused variables.

php artisan check:events

For example, consider:

1 - It checks the \App\Listeners\MyListener classpath to be valid.

2 - It checks the myMethod method to exist on the MyListener class

3 - It checks the myMethod method to have the right type-hint (if any) in its signature, for example:

This is a valid but wrong type-hint, and will be reported to you. Very cool, isn't it ??!

1- in the EventServiceProvider,

2- By Event::listen facade,

3- By Subscriber class... or any other way. The error would be found. :)

php artisan check:gates

It checks the validity of all the gates you have defined, making sure that they refer to a valid class and method.

It also checks for the policy definitions to be valid.

1 - It checks the User classpath to be valid.

2 - It checks the UserPolicy classpath to be valid.

3 - It checks the someMethod method to exist.

php artisan check:dynamic_where

php artisan enforce:query

php artisan check:dead_controllers

php artisan check:generic_docblocks {--folder=app/Models} {--file=SomeFile.php}

php artisan enforce:helper_functions {--folder=app/Models} {--file=SomeFile.php}

php artisan list:models {--folder=app/Models}

And more features will be added soon. ;)

Credits

License

The MIT License (MIT). Please see License File for more information.

:raising_hand: Contributing

If you find an issue or have a better way to do something, feel free to open an issue or a pull request. If you use laravel-microscope in your open source project, create a pull request to provide its URL as a sample application in the README.md file.

:exclamation: Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

More from the author:

Laravel HeyMan

:gem: It allows us to write expressive code to authorize, validate, and authenticate.


Laravel Terminator

:gem: A minimal yet powerful package which allows you to refactor your controllers.

Laravel AnyPass

:gem: It allows you to login with any password in the local environment only.

❤️ Contributors

This project exists thanks to all the people who contribute. [Contributors].

⭐ Star History

Star History Chart


All versions of laravel-self-test with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|8.0.*|8.1.*|8.2.*|8.3.*
imanghafoori/composer-json Version ^1.0.14
composer/class-map-generator Version ^1.0.0
imanghafoori/php-abstract-filesystem Version ^0.1.5
imanghafoori/php-search-replace Version ^1.1.12
imanghafoori/php-token-analyzer Version ^0.1.73
imanghafoori/php-imports-analyzer Version ^1.0.6
imanghafoori/smart-realtime-facades Version ^1.1.8
jetbrains/phpstorm-attributes Version 1.*
laravel/framework Version 5.*|6.*|7.*|8.*|9.*|10.*|11.*
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 imanghafoori/laravel-self-test contains the following files

Loading the files please wait ....