imanghafoori1 / laravel-heyman Goto Github PK
View Code? Open in Web Editor NEWDeclarative style of authorization and validation in laravel.
License: MIT License
Declarative style of authorization and validation in laravel.
License: MIT License
I'm using PHP 7.3.8 and Laravel 7
I got the following error when trying to install the package.
Using version ^2.2 for imanghafoori/laravel-heyman
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223
Any suggestion is appreciated.
This problem happened to me several times in the past but I did not report it thinking it could be several things.
But after encountering this problems several times during installing laravel-heyman, I try to reproduce the error.
After installing new laravel project with "laravel new name"
then run "composer require imanghafoori/laravel-heyman"
I got the following error.
composer require imanghafoori/laravel-heyman
Using version ^2.2 for imanghafoori/laravel-heyman
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
Environment: Windows 10, PHP 7.4, composer 1.10, laravel installer 4.0
Hi, i'm really in love with what you did and the fact that, it doesn't necessarily need to be added to an existing code (Controller) makes it more flexible.
However, i have an issue with the spell termination. If you say "whenDoingThis", this assume the action has already taken place, and some might not understand that "whenDoingThis" is occuring before.
So i would like to suggest renaming "when.." to "before...". This can increase the possibility because it will be possible to do something like "afterDoingThis".
Anyway, good job. I might use it on my upcoming projects.
AssertThat( boolean )
As what i can see, the library is closely linked to plain Laravel installation. However, many out there already have a laravel application with their superset of functions (classes). So, we might introduce an asset true (or assertThat) method, which give the developper the capacity to to his own assetion and proceed (or not) the even.
Example :
use App\Factory\Post as PostFactory;
// ...
HeyMan::whenYouDelete( App\Models\Post::class )
->assertThat( PostFactory::OnePostLeft() )
// ...
redirectTo()
Having to write down ->redirect()->to()... makes the chain more longer. We might implement a method like ->redirectTo() which join both methods.
Well, we're handling exception in a different ways on our laravel application. I assume many might have a different view (message) for different exceptions. It might be interesting on the chain to throw an exception.
Edit : i've seen that there is a Exception method, we might then consider reducing the chain.
Example :
use App\Guards\HeavenGuard;
use Illuminate\Support\Auth;
use App\Exceptions\NotForYouException;
// ...
HeyMan::whenYouVisitUrl( '/paradise' )
->assertThat( HeavenGuard::isBlessed( Auth::user() ) ) // new method
->otherwiseThrow( NotForYouException::class )
// ...
whenYouVisiteRoute()
instead of typing down the URL with slashes, we might have a route support method.
When I make the command db: seed I get the following error: 'Undefined index: eloquentChecks'
It is not an issue, it is more a feature, but I would like to use this declarative style in my tests, do you think it is possible to do this?
Error on require in laravel v10
Using version ^2.2 for imanghafoori/laravel-heyman
./composer.json has been updated
Running composer update imanghafoori/laravel-heyman
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- imanghafoori/laravel-heyman[2.2.0, ..., 2.2.7] require laravel/framework ~5.3 -> found laravel/framework[v5.3.0, ..., v5.8.38] but it conflicts with your root composer.json require (^10.0).
- imanghafoori/laravel-heyman[2.2.8, ..., v2.2.34] require laravel/framework ~5.1 -> found laravel/framework[v5.1.0, ..., v5.8.38] but it conflicts with your root composer.json require (^10.0).
- imanghafoori/laravel-heyman[v2.2.35, ..., v2.2.43] require laravel/framework ~5.1|6.* -> found laravel/framework[v5.1.0, ..., v5.8.38, v6.0.0, ..., v6.20.44] but it conflicts with your root composer.json require (^10.0).
- imanghafoori/laravel-heyman[v2.2.44, ..., v2.2.45] require laravel/framework ~5.1|6.|7. -> found laravel/framework[v5.1.0, ..., v5.8.38, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6] but it conflicts with your root composer.json require (^10.0).
- imanghafoori/laravel-heyman[v2.2.46, ..., v2.2.52] require laravel/framework ~5.1|6.|7.|8.* -> found laravel/framework[v5.1.0, ..., v5.8.38, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but it conflicts with your root composer.json require (^10.0).
- imanghafoori/laravel-heyman[v2.2.53, ..., v2.2.54] require laravel/framework ~5.1|6.|7.|8.|9. -> found laravel/framework[v5.1.0, ..., v5.8.38, v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.0] but it conflicts with your root composer.json require (^10.0).
- Root composer.json requires imanghafoori/laravel-heyman ^2.2 -> satisfiable by imanghafoori/laravel-heyman[2.2.0, ..., v2.2.54].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require imanghafoori/laravel-heyman:*" to figure out if any version is installable, or "composer require imanghafoori/laravel-heyman:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Is there a way to use HeyMan together with Laravel policy?
I only found an example for Gate but no policy anywhere.
Thanks in advance.
Dear @imanghafoori1, I am very attracted to use this package on my new project. But have a question since I use Dingo/Api package with this.
I want do something like bellow:
HeyMan::
whenYouCallAction('App\Api\V1\Controllers\SomeController@action')
...
I saw this line where you hard code the controllers' namespace
my question is; how can I use my own namespace onwhenYouCallAction
function?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.